Skip to content

Commit d5e8c0c

Browse files
committed
remove type=datetime (removed from HTML5 spec)
1 parent 5615b7d commit d5e8c0c

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

dateInput.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
return parseDate(date + '-01');
152152
};
153153
var globalSettings = {
154-
datetime: {
154+
'datetime-local': {
155155
parseFunction: parseDateTime,
156156
create: function(object, settings) {
157157
return object.datetimepicker(settings);
@@ -193,8 +193,6 @@
193193
validFormat: '\\d{2}:\\d{2}'
194194
}
195195
};
196-
globalSettings['datetime-local'] = globalSettings.datetime;
197-
globalSettings['datetime-local'].validFormat += '.*'; // timezone
198196

199197
$.fn.dateinput = function(userSettings) {
200198
this.each(function() {
@@ -263,7 +261,6 @@
263261

264262
//
265263
switch (type) {
266-
case 'datetime':
267264
case 'datetime-local':
268265
$.extend(pickerSettings, {
269266
altFieldTimeOnly: false,

readme.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,13 @@ initialize the calendar using javascript:
3838
```js
3939
$(document).ready(function() {
4040
$('input[data-dateinput-type]').dateinput({
41-
datetime: {
41+
'datetime-local': {
4242
dateFormat: 'd.m.yy',
4343
timeFormat: 'H:mm',
44-
options: { // options for type=datetime
44+
options: { // options for type=datetime-local
4545
changeYear: true
4646
}
4747
},
48-
'datetime-local': {
49-
dateFormat: 'd.m.yy',
50-
timeFormat: 'H:mm'
51-
},
5248
date: {
5349
dateFormat: 'd.m.yy'
5450
},

src/DateInput.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
*/
4444
class DateInput extends BaseControl {
4545

46-
public const TYPE_DATETIME = 'datetime',
46+
public const
4747
TYPE_DATETIME_LOCAL = 'datetime-local',
4848
TYPE_DATE = 'date',
4949
TYPE_MONTH = 'month',
@@ -65,7 +65,6 @@ class DateInput extends BaseControl {
6565
public static $defaultValidMessage = 'Please enter a valid date.';
6666

6767
private static $formats = [
68-
self::TYPE_DATETIME => 'Y-m-d\TH:i:se',
6968
self::TYPE_DATETIME_LOCAL => 'Y-m-d\TH:i:s',
7069
self::TYPE_DATE => 'Y-m-d',
7170
self::TYPE_MONTH => 'Y-m',
@@ -78,7 +77,7 @@ public static function register($immutable = true): void {
7877
Container $form,
7978
string $name,
8079
string $label = null,
81-
string $type = 'datetime-local'
80+
string $type = self::TYPE_DATETIME_LOCAL
8281
) use ($immutable) {
8382
$component = new self($label, $type, $immutable);
8483
$form->addComponent($component, $name);

0 commit comments

Comments
 (0)