xdan-datetimepicker-rails 2.5.3 → 2.5.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f2c45dc2a91fb2808492cdd992e245cbc4b029
|
4
|
+
data.tar.gz: ae06d8609db5ca2d3c2d93ab4752af49d7f32ccf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4152a014c574ff37944d617428b28778cef52e45373c3253c5cce42f24b4ea4cfffb622b3dc34ddebde706926b4b62f1ca7b56f939b4ac90c9214695fd7f369
|
7
|
+
data.tar.gz: 616470d0b3862380516f88b6ac9a5ddcc504a0495812d0549b98c332f234a289bf2552a0c883665f0fe26aea8506848255cb2ec71e014ca2226e9254917d344c
|
@@ -575,7 +575,7 @@ var DateFormatter;
|
|
575
575
|
}
|
576
576
|
};
|
577
577
|
})();/**
|
578
|
-
* @preserve jQuery DateTimePicker plugin v2.5.
|
578
|
+
* @preserve jQuery DateTimePicker plugin v2.5.4
|
579
579
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
580
580
|
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
|
581
581
|
*/
|
@@ -1501,7 +1501,8 @@ var DateFormatter;
|
|
1501
1501
|
setPos,
|
1502
1502
|
timer = 0,
|
1503
1503
|
_xdsoft_datetime,
|
1504
|
-
forEachAncestorOf
|
1504
|
+
forEachAncestorOf,
|
1505
|
+
throttle;
|
1505
1506
|
|
1506
1507
|
if (options.id) {
|
1507
1508
|
datetimepicker.attr('id', options.id);
|
@@ -1755,21 +1756,23 @@ var DateFormatter;
|
|
1755
1756
|
if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
|
1756
1757
|
$(this).val(null);
|
1757
1758
|
datetimepicker.data('xdsoft_datetime').empty();
|
1758
|
-
} else
|
1759
|
-
var
|
1760
|
-
|
1761
|
-
|
1762
|
-
// parse the numbers as 0312 => 03:12
|
1763
|
-
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
|
1764
|
-
$(this).val([splittedHours, splittedMinutes].map(function (item) {
|
1765
|
-
return item > 9 ? item : '0' + item;
|
1766
|
-
}).join(':'));
|
1759
|
+
} else {
|
1760
|
+
var d = dateHelper.parseDate($(this).val(), options.format);
|
1761
|
+
if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
|
1762
|
+
$(this).val(dateHelper.formatDate(d, options.format));
|
1767
1763
|
} else {
|
1768
|
-
$(this).val(
|
1764
|
+
var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
|
1765
|
+
splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
|
1766
|
+
|
1767
|
+
// parse the numbers as 0312 => 03:12
|
1768
|
+
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
|
1769
|
+
$(this).val([splittedHours, splittedMinutes].map(function (item) {
|
1770
|
+
return item > 9 ? item : '0' + item;
|
1771
|
+
}).join(':'));
|
1772
|
+
} else {
|
1773
|
+
$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
|
1774
|
+
}
|
1769
1775
|
}
|
1770
|
-
|
1771
|
-
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
1772
|
-
} else {
|
1773
1776
|
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
1774
1777
|
}
|
1775
1778
|
|
@@ -1852,8 +1855,20 @@ var DateFormatter;
|
|
1852
1855
|
return !isNaN(d.getTime());
|
1853
1856
|
};
|
1854
1857
|
|
1855
|
-
_this.setCurrentTime = function (dTime) {
|
1856
|
-
|
1858
|
+
_this.setCurrentTime = function (dTime, requireValidDate) {
|
1859
|
+
if (typeof dTime === 'string') {
|
1860
|
+
_this.currentTime = _this.strToDateTime(dTime);
|
1861
|
+
}
|
1862
|
+
else if (_this.isValidDate(dTime)) {
|
1863
|
+
_this.currentTime = dTime;
|
1864
|
+
}
|
1865
|
+
else if (!dTime && !requireValidDate && options.allowBlank) {
|
1866
|
+
_this.currentTime = null;
|
1867
|
+
}
|
1868
|
+
else {
|
1869
|
+
_this.currentTime = _this.now();
|
1870
|
+
}
|
1871
|
+
|
1857
1872
|
datetimepicker.trigger('xchange.xdsoft');
|
1858
1873
|
};
|
1859
1874
|
|
@@ -2006,7 +2021,7 @@ var DateFormatter;
|
|
2006
2021
|
.find('.xdsoft_today_button')
|
2007
2022
|
.on('touchend mousedown.xdsoft', function () {
|
2008
2023
|
datetimepicker.data('changed', true);
|
2009
|
-
_xdsoft_datetime.setCurrentTime(0);
|
2024
|
+
_xdsoft_datetime.setCurrentTime(0, true);
|
2010
2025
|
datetimepicker.trigger('afterOpen.xdsoft');
|
2011
2026
|
}).on('dblclick.xdsoft', function () {
|
2012
2027
|
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
|
@@ -2103,6 +2118,10 @@ var DateFormatter;
|
|
2103
2118
|
xchangeTimer = setTimeout(function () {
|
2104
2119
|
|
2105
2120
|
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
|
2121
|
+
//In case blanks are allowed, delay construction until we have a valid date
|
2122
|
+
if (options.allowBlank)
|
2123
|
+
return;
|
2124
|
+
|
2106
2125
|
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
|
2107
2126
|
}
|
2108
2127
|
|
@@ -2828,7 +2847,7 @@ var DateFormatter;
|
|
2828
2847
|
}
|
2829
2848
|
|
2830
2849
|
triggerAfterOpen = true;
|
2831
|
-
_xdsoft_datetime.setCurrentTime(getCurrentValue());
|
2850
|
+
_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
|
2832
2851
|
if(options.mask) {
|
2833
2852
|
setMask(options);
|
2834
2853
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @preserve jQuery DateTimePicker plugin v2.5.
|
2
|
+
* @preserve jQuery DateTimePicker plugin v2.5.4
|
3
3
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
4
4
|
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
|
5
5
|
*/
|
@@ -925,7 +925,8 @@
|
|
925
925
|
setPos,
|
926
926
|
timer = 0,
|
927
927
|
_xdsoft_datetime,
|
928
|
-
forEachAncestorOf
|
928
|
+
forEachAncestorOf,
|
929
|
+
throttle;
|
929
930
|
|
930
931
|
if (options.id) {
|
931
932
|
datetimepicker.attr('id', options.id);
|
@@ -1179,21 +1180,23 @@
|
|
1179
1180
|
if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
|
1180
1181
|
$(this).val(null);
|
1181
1182
|
datetimepicker.data('xdsoft_datetime').empty();
|
1182
|
-
} else
|
1183
|
-
var
|
1184
|
-
|
1185
|
-
|
1186
|
-
// parse the numbers as 0312 => 03:12
|
1187
|
-
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
|
1188
|
-
$(this).val([splittedHours, splittedMinutes].map(function (item) {
|
1189
|
-
return item > 9 ? item : '0' + item;
|
1190
|
-
}).join(':'));
|
1183
|
+
} else {
|
1184
|
+
var d = dateHelper.parseDate($(this).val(), options.format);
|
1185
|
+
if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
|
1186
|
+
$(this).val(dateHelper.formatDate(d, options.format));
|
1191
1187
|
} else {
|
1192
|
-
$(this).val(
|
1188
|
+
var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
|
1189
|
+
splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
|
1190
|
+
|
1191
|
+
// parse the numbers as 0312 => 03:12
|
1192
|
+
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
|
1193
|
+
$(this).val([splittedHours, splittedMinutes].map(function (item) {
|
1194
|
+
return item > 9 ? item : '0' + item;
|
1195
|
+
}).join(':'));
|
1196
|
+
} else {
|
1197
|
+
$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
|
1198
|
+
}
|
1193
1199
|
}
|
1194
|
-
|
1195
|
-
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
1196
|
-
} else {
|
1197
1200
|
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
1198
1201
|
}
|
1199
1202
|
|
@@ -1276,8 +1279,20 @@
|
|
1276
1279
|
return !isNaN(d.getTime());
|
1277
1280
|
};
|
1278
1281
|
|
1279
|
-
_this.setCurrentTime = function (dTime) {
|
1280
|
-
|
1282
|
+
_this.setCurrentTime = function (dTime, requireValidDate) {
|
1283
|
+
if (typeof dTime === 'string') {
|
1284
|
+
_this.currentTime = _this.strToDateTime(dTime);
|
1285
|
+
}
|
1286
|
+
else if (_this.isValidDate(dTime)) {
|
1287
|
+
_this.currentTime = dTime;
|
1288
|
+
}
|
1289
|
+
else if (!dTime && !requireValidDate && options.allowBlank) {
|
1290
|
+
_this.currentTime = null;
|
1291
|
+
}
|
1292
|
+
else {
|
1293
|
+
_this.currentTime = _this.now();
|
1294
|
+
}
|
1295
|
+
|
1281
1296
|
datetimepicker.trigger('xchange.xdsoft');
|
1282
1297
|
};
|
1283
1298
|
|
@@ -1430,7 +1445,7 @@
|
|
1430
1445
|
.find('.xdsoft_today_button')
|
1431
1446
|
.on('touchend mousedown.xdsoft', function () {
|
1432
1447
|
datetimepicker.data('changed', true);
|
1433
|
-
_xdsoft_datetime.setCurrentTime(0);
|
1448
|
+
_xdsoft_datetime.setCurrentTime(0, true);
|
1434
1449
|
datetimepicker.trigger('afterOpen.xdsoft');
|
1435
1450
|
}).on('dblclick.xdsoft', function () {
|
1436
1451
|
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
|
@@ -1527,6 +1542,10 @@
|
|
1527
1542
|
xchangeTimer = setTimeout(function () {
|
1528
1543
|
|
1529
1544
|
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
|
1545
|
+
//In case blanks are allowed, delay construction until we have a valid date
|
1546
|
+
if (options.allowBlank)
|
1547
|
+
return;
|
1548
|
+
|
1530
1549
|
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
|
1531
1550
|
}
|
1532
1551
|
|
@@ -2252,7 +2271,7 @@
|
|
2252
2271
|
}
|
2253
2272
|
|
2254
2273
|
triggerAfterOpen = true;
|
2255
|
-
_xdsoft_datetime.setCurrentTime(getCurrentValue());
|
2274
|
+
_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
|
2256
2275
|
if(options.mask) {
|
2257
2276
|
setMask(options);
|
2258
2277
|
}
|