xdan-datetimepicker-rails 2.3.9 → 2.4.1
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: 00896cc12400d16a48440fa43bcbadd40855083b
|
4
|
+
data.tar.gz: fd0ad32a238fe313220e254489fce0389704ca56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17ebbb0f709c70952c82181b7d5e876924c1e59785fdf3b66e39423922db4854e530d0948a2198562b969ea9a7c0dfe2a3befc3e3809f7fa3d5d5568d0a1b6e0
|
7
|
+
data.tar.gz: dd2d34ced2ba0187943de302f9813c9e5b8cf5920dda2d7a0c90bef9d9aa550912343e782d7815803821de6e4f00cde9045cd7594cec7d721561e656aeed369a
|
data/README.md
CHANGED
@@ -33,12 +33,103 @@ Import the stylesheet in your `application.css.scss` file:
|
|
33
33
|
Start using it!
|
34
34
|
|
35
35
|
```coffee
|
36
|
+
# /app/assets/javascripts/datetimepicker.js.coffee
|
37
|
+
|
38
|
+
#= require jquery.xdan.datetimepicker
|
39
|
+
|
40
|
+
@setupDateTimePicker = (container) ->
|
41
|
+
defaults = {
|
42
|
+
formatDate: 'y-m-d',
|
43
|
+
format: 'Y-m-d H:i',
|
44
|
+
allowBlank: true,
|
45
|
+
defaultSelect: false,
|
46
|
+
validateOnBlur: false
|
47
|
+
}
|
48
|
+
|
49
|
+
entries = $(container).find('input.datetimepicker')
|
50
|
+
entries.each (index, entry) ->
|
51
|
+
options = $(entry).data 'datepicker-options'
|
52
|
+
$(entry).datetimepicker $.extend(defaults, options)
|
53
|
+
|
36
54
|
$ ->
|
37
|
-
$(
|
55
|
+
setupDateTimePicker $('body')
|
56
|
+
|
38
57
|
```
|
39
58
|
|
59
|
+
|
40
60
|
See the [detailed documentation](http://xdsoft.net/jqplugins/datetimepicker/) for more options. When the site is back up I'll try to port some of them into this README or move them to the official repo of [datetimepicker](https://github.com/xdan/datetimepicker).
|
41
61
|
|
62
|
+
### SimpleForm Integration
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
# /app/inputs/datetimepicker_input.rb
|
66
|
+
|
67
|
+
class DatetimepickerInput < SimpleForm::Inputs::StringInput
|
68
|
+
def input_html_classes
|
69
|
+
super.push("datetimepicker")
|
70
|
+
end
|
71
|
+
|
72
|
+
def input_type
|
73
|
+
:string
|
74
|
+
end
|
75
|
+
|
76
|
+
def input_html_options
|
77
|
+
super.tap do |opts|
|
78
|
+
opts[:data] ||= {}
|
79
|
+
opts[:data].merge! datepicker_options
|
80
|
+
opts[:value] ||= value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def value
|
85
|
+
val = object.send(attribute_name)
|
86
|
+
return DateTime.new(val.year, val.month, val.day, val.hour, val.min).strftime("%Y-%m-%d %H:%M") if val.is_a?(Time)
|
87
|
+
return val if val.nil?
|
88
|
+
val.to_s
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
def datepicker_options
|
93
|
+
options = self.options.fetch(:datepicker_options, {})
|
94
|
+
options = Hash[options.map{ |k, v| [k.to_s.camelcase(:lower), v] }]
|
95
|
+
{ datepicker_options: options }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
### Formtastic Integration
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
# /app/inputs/datetimepicker_input.rb
|
105
|
+
|
106
|
+
class DatetimepickerInput < ::Formtastic::Inputs::StringInput
|
107
|
+
def input_html_options
|
108
|
+
super.tap do |options|
|
109
|
+
options[:class] = [options[:class], "datetimepicker"].compact.join(' ')
|
110
|
+
options[:data] ||= {}
|
111
|
+
options[:data].merge! datepicker_options
|
112
|
+
options[:value] ||= value
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def value
|
117
|
+
val = object.send(method)
|
118
|
+
return DateTime.new(val.year, val.month, val.day, val.hour, val.min).strftime("%Y-%m-%d %H:%M") if val.is_a?(Time)
|
119
|
+
return val if val.nil?
|
120
|
+
val.to_s
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
def datepicker_options
|
125
|
+
options = self.options.fetch(:datepicker_options, {})
|
126
|
+
options = Hash[options.map{ |k, v| [k.to_s.camelcase(:lower), v] }]
|
127
|
+
{ datepicker_options: options }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
```
|
132
|
+
|
42
133
|
## Versioning
|
43
134
|
|
44
135
|
This gem will attempt to maintain the same version as the `datetimepicker` library.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @preserve jQuery DateTimePicker plugin v2.
|
2
|
+
* @preserve jQuery DateTimePicker plugin v2.4.1
|
3
3
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
4
4
|
* (c) 2014, Chupurnov Valeriy.
|
5
5
|
*/
|
@@ -231,6 +231,198 @@
|
|
231
231
|
dayOfWeek: [
|
232
232
|
"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
|
233
233
|
]
|
234
|
+
},
|
235
|
+
az: { //Azerbaijanian (Azeri)
|
236
|
+
months: [
|
237
|
+
"Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
|
238
|
+
],
|
239
|
+
dayOfWeek: [
|
240
|
+
"B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
|
241
|
+
]
|
242
|
+
},
|
243
|
+
bs: { //Bosanski
|
244
|
+
months: [
|
245
|
+
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
|
246
|
+
],
|
247
|
+
dayOfWeek: [
|
248
|
+
"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
|
249
|
+
]
|
250
|
+
},
|
251
|
+
ca: { //Català
|
252
|
+
months: [
|
253
|
+
"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
|
254
|
+
],
|
255
|
+
dayOfWeek: [
|
256
|
+
"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
|
257
|
+
]
|
258
|
+
},
|
259
|
+
'en-GB': { //English (British)
|
260
|
+
months: [
|
261
|
+
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
262
|
+
],
|
263
|
+
dayOfWeek: [
|
264
|
+
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
265
|
+
]
|
266
|
+
},
|
267
|
+
et: { //"Eesti"
|
268
|
+
months: [
|
269
|
+
"Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
|
270
|
+
],
|
271
|
+
dayOfWeek: [
|
272
|
+
"P", "E", "T", "K", "N", "R", "L"
|
273
|
+
]
|
274
|
+
},
|
275
|
+
eu: { //Euskara
|
276
|
+
months: [
|
277
|
+
"Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
|
278
|
+
],
|
279
|
+
dayOfWeek: [
|
280
|
+
"Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
|
281
|
+
]
|
282
|
+
},
|
283
|
+
fi: { //Finnish (Suomi)
|
284
|
+
months: [
|
285
|
+
"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
|
286
|
+
],
|
287
|
+
dayOfWeek: [
|
288
|
+
"Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
|
289
|
+
]
|
290
|
+
},
|
291
|
+
gl: { //Galego
|
292
|
+
months: [
|
293
|
+
"Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
|
294
|
+
],
|
295
|
+
dayOfWeek: [
|
296
|
+
"Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
|
297
|
+
]
|
298
|
+
},
|
299
|
+
hr: { //Hrvatski
|
300
|
+
months: [
|
301
|
+
"Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
|
302
|
+
],
|
303
|
+
dayOfWeek: [
|
304
|
+
"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
|
305
|
+
]
|
306
|
+
},
|
307
|
+
ko: { //Korean (한국어)
|
308
|
+
months: [
|
309
|
+
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
|
310
|
+
],
|
311
|
+
dayOfWeek: [
|
312
|
+
"일", "월", "화", "수", "목", "금", "토"
|
313
|
+
]
|
314
|
+
},
|
315
|
+
lt: { //Lithuanian (lietuvių)
|
316
|
+
months: [
|
317
|
+
"Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
|
318
|
+
],
|
319
|
+
dayOfWeek: [
|
320
|
+
"Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
|
321
|
+
]
|
322
|
+
},
|
323
|
+
lv: { //Latvian (Latviešu)
|
324
|
+
months: [
|
325
|
+
"Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
|
326
|
+
],
|
327
|
+
dayOfWeek: [
|
328
|
+
"Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
|
329
|
+
]
|
330
|
+
},
|
331
|
+
mk: { //Macedonian (Македонски)
|
332
|
+
months: [
|
333
|
+
"јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
|
334
|
+
],
|
335
|
+
dayOfWeek: [
|
336
|
+
"нед", "пон", "вто", "сре", "чет", "пет", "саб"
|
337
|
+
]
|
338
|
+
},
|
339
|
+
mn: { //Mongolian (Монгол)
|
340
|
+
months: [
|
341
|
+
"1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
|
342
|
+
],
|
343
|
+
dayOfWeek: [
|
344
|
+
"Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
|
345
|
+
]
|
346
|
+
},
|
347
|
+
'pt-BR': { //Português(Brasil)
|
348
|
+
months: [
|
349
|
+
"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
|
350
|
+
],
|
351
|
+
dayOfWeek: [
|
352
|
+
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
|
353
|
+
]
|
354
|
+
},
|
355
|
+
sk: { //Slovenčina
|
356
|
+
months: [
|
357
|
+
"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
|
358
|
+
],
|
359
|
+
dayOfWeek: [
|
360
|
+
"Ne", "Po", "Ut", "St", "Št", "Pi", "So"
|
361
|
+
]
|
362
|
+
},
|
363
|
+
sq: { //Albanian (Shqip)
|
364
|
+
months: [
|
365
|
+
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
366
|
+
],
|
367
|
+
dayOfWeek: [
|
368
|
+
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
369
|
+
]
|
370
|
+
},
|
371
|
+
'sr-YU': { //Serbian (Srpski)
|
372
|
+
months: [
|
373
|
+
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
|
374
|
+
],
|
375
|
+
dayOfWeek: [
|
376
|
+
"Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
|
377
|
+
]
|
378
|
+
},
|
379
|
+
sr: { //Serbian Cyrillic (Српски)
|
380
|
+
months: [
|
381
|
+
"јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
|
382
|
+
],
|
383
|
+
dayOfWeek: [
|
384
|
+
"нед", "пон", "уто", "сре", "чет", "пет", "суб"
|
385
|
+
]
|
386
|
+
},
|
387
|
+
sv: { //Svenska
|
388
|
+
months: [
|
389
|
+
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
|
390
|
+
],
|
391
|
+
dayOfWeek: [
|
392
|
+
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
|
393
|
+
]
|
394
|
+
},
|
395
|
+
'zh-TW': { //Traditional Chinese (繁體中文)
|
396
|
+
months: [
|
397
|
+
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
|
398
|
+
],
|
399
|
+
dayOfWeek: [
|
400
|
+
"日", "一", "二", "三", "四", "五", "六"
|
401
|
+
]
|
402
|
+
},
|
403
|
+
zh: { //Simplified Chinese (简体中文)
|
404
|
+
months: [
|
405
|
+
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
|
406
|
+
],
|
407
|
+
dayOfWeek: [
|
408
|
+
"日", "一", "二", "三", "四", "五", "六"
|
409
|
+
]
|
410
|
+
},
|
411
|
+
he: { //Hebrew (עברית)
|
412
|
+
months: [
|
413
|
+
'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
|
414
|
+
],
|
415
|
+
dayOfWeek: [
|
416
|
+
'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
|
417
|
+
]
|
418
|
+
},
|
419
|
+
hy: { // Armenian
|
420
|
+
months: [
|
421
|
+
"Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
|
422
|
+
],
|
423
|
+
dayOfWeek: [
|
424
|
+
"Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
|
425
|
+
]
|
234
426
|
}
|
235
427
|
},
|
236
428
|
value: '',
|
@@ -506,12 +698,11 @@
|
|
506
698
|
lazyInitTimer = 0,
|
507
699
|
createDateTimePicker,
|
508
700
|
destroyDateTimePicker,
|
509
|
-
_xdsoft_datetime,
|
510
701
|
|
511
702
|
lazyInit = function (input) {
|
512
703
|
input
|
513
704
|
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) {
|
514
|
-
if (input.is(':disabled') || input.
|
705
|
+
if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
|
515
706
|
return;
|
516
707
|
}
|
517
708
|
clearTimeout(lazyInitTimer);
|
@@ -551,7 +742,8 @@
|
|
551
742
|
current_time_index,
|
552
743
|
setPos,
|
553
744
|
timer = 0,
|
554
|
-
timer1 = 0
|
745
|
+
timer1 = 0,
|
746
|
+
_xdsoft_datetime;
|
555
747
|
|
556
748
|
mounth_picker
|
557
749
|
.find('.xdsoft_month span')
|
@@ -805,16 +997,28 @@
|
|
805
997
|
input
|
806
998
|
.off('blur.xdsoft')
|
807
999
|
.on('blur.xdsoft', function () {
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
1000
|
+
if (options.allowBlank && !$.trim($(this).val()).length) {
|
1001
|
+
$(this).val(null);
|
1002
|
+
datetimepicker.data('xdsoft_datetime').empty();
|
1003
|
+
} else if (!Date.parseDate($(this).val(), options.format)) {
|
1004
|
+
var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
|
1005
|
+
splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
|
1006
|
+
|
1007
|
+
// parse the numbers as 0312 => 03:12
|
1008
|
+
if(!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
|
1009
|
+
$(this).val([splittedHours, splittedMinutes].map(function(item) {
|
1010
|
+
return item > 9 ? item : '0' + item
|
1011
|
+
}).join(':'));
|
1012
|
+
} else {
|
1013
|
+
$(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
1017
|
+
} else {
|
1018
|
+
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
datetimepicker.trigger('changedatetime.xdsoft');
|
818
1022
|
});
|
819
1023
|
}
|
820
1024
|
options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
|
@@ -1174,7 +1378,7 @@
|
|
1174
1378
|
classes.push('xdsoft_today');
|
1175
1379
|
}
|
1176
1380
|
|
1177
|
-
if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate))
|
1381
|
+
if (start.getDay() === 0 || start.getDay() === 6 || ~options.weekends.indexOf(start.dateFormat(options.formatDate))) {
|
1178
1382
|
classes.push('xdsoft_weekend');
|
1179
1383
|
}
|
1180
1384
|
|
@@ -1218,9 +1422,11 @@
|
|
1218
1422
|
h = parseInt(now.getHours(), 10);
|
1219
1423
|
now.setMinutes(m);
|
1220
1424
|
m = parseInt(now.getMinutes(), 10);
|
1221
|
-
|
1425
|
+
var optionDateTime = new Date(_xdsoft_datetime.currentTime);
|
1426
|
+
optionDateTime.setHours(h);
|
1427
|
+
optionDateTime.setMinutes(m);
|
1222
1428
|
classes = [];
|
1223
|
-
if
|
1429
|
+
if((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) {
|
1224
1430
|
classes.push('xdsoft_disabled');
|
1225
1431
|
}
|
1226
1432
|
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours(), 10) === parseInt(h, 10) && (options.step > 59 || Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step === parseInt(m, 10))) {
|
@@ -1487,6 +1693,13 @@
|
|
1487
1693
|
}
|
1488
1694
|
event.stopPropagation();
|
1489
1695
|
})
|
1696
|
+
.on('toggle.xdsoft', function (event) {
|
1697
|
+
if (datetimepicker.is(':visible')) {
|
1698
|
+
datetimepicker.trigger('close.xdsoft');
|
1699
|
+
} else {
|
1700
|
+
datetimepicker.trigger('open.xdsoft');
|
1701
|
+
}
|
1702
|
+
})
|
1490
1703
|
.data('input', input);
|
1491
1704
|
|
1492
1705
|
timer = 0;
|
@@ -1529,12 +1742,12 @@
|
|
1529
1742
|
input
|
1530
1743
|
.data('xdsoft_datetimepicker', datetimepicker)
|
1531
1744
|
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) {
|
1532
|
-
if (input.is(':disabled') ||
|
1745
|
+
if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
|
1533
1746
|
return;
|
1534
1747
|
}
|
1535
1748
|
clearTimeout(timer);
|
1536
1749
|
timer = setTimeout(function () {
|
1537
|
-
if (input.is(':disabled')
|
1750
|
+
if (input.is(':disabled')) {
|
1538
1751
|
return;
|
1539
1752
|
}
|
1540
1753
|
|
@@ -1598,6 +1811,9 @@
|
|
1598
1811
|
case 'hide':
|
1599
1812
|
datetimepicker.trigger('close.xdsoft');
|
1600
1813
|
break;
|
1814
|
+
case 'toggle':
|
1815
|
+
datetimepicker.trigger('toggle.xdsoft');
|
1816
|
+
break;
|
1601
1817
|
case 'destroy':
|
1602
1818
|
destroyDateTimePicker($(this));
|
1603
1819
|
break;
|
@@ -1651,5 +1867,5 @@
|
|
1651
1867
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
1652
1868
|
* details.
|
1653
1869
|
*/
|
1654
|
-
Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var
|
1870
|
+
Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var codePrefix="Date.prototype."+funcName+" = function() {return ";var code="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}if(code.length==0){code="\"\"";}else{code=code.substring(0,code.length-3);}eval(codePrefix+code+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};
|
1655
1871
|
}());
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.xdsoft_datetimepicker{
|
2
|
-
box-shadow:
|
2
|
+
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
|
3
3
|
background: #FFFFFF;
|
4
4
|
border-bottom: 1px solid #BBBBBB;
|
5
5
|
border-left: 1px solid #CCCCCC;
|
@@ -8,7 +8,7 @@
|
|
8
8
|
color: #333333;
|
9
9
|
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
10
10
|
padding: 8px;
|
11
|
-
padding-left:
|
11
|
+
padding-left: 0;
|
12
12
|
padding-top: 2px;
|
13
13
|
position: absolute;
|
14
14
|
z-index: 9999;
|
@@ -50,8 +50,8 @@
|
|
50
50
|
.xdsoft_datetimepicker *{
|
51
51
|
-moz-box-sizing: border-box;
|
52
52
|
box-sizing: border-box;
|
53
|
-
padding:
|
54
|
-
margin:
|
53
|
+
padding: 0;
|
54
|
+
margin: 0;
|
55
55
|
}
|
56
56
|
.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker{
|
57
57
|
display:none;
|
@@ -72,7 +72,7 @@
|
|
72
72
|
float:left;
|
73
73
|
text-align:center;
|
74
74
|
margin-left:8px;
|
75
|
-
margin-top:
|
75
|
+
margin-top: 0;
|
76
76
|
}
|
77
77
|
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{
|
78
78
|
margin-top:8px;
|
@@ -101,17 +101,17 @@
|
|
101
101
|
|
102
102
|
.xdsoft_datetimepicker .xdsoft_prev{
|
103
103
|
float: left;
|
104
|
-
background-position:-20px
|
104
|
+
background-position:-20px 0;
|
105
105
|
}
|
106
106
|
.xdsoft_datetimepicker .xdsoft_today_button{
|
107
107
|
float: left;
|
108
|
-
background-position:-70px
|
108
|
+
background-position:-70px 0;
|
109
109
|
margin-left:5px;
|
110
110
|
}
|
111
111
|
|
112
112
|
.xdsoft_datetimepicker .xdsoft_next{
|
113
113
|
float: right;
|
114
|
-
background-position:
|
114
|
+
background-position: 0 0;
|
115
115
|
}
|
116
116
|
|
117
117
|
.xdsoft_datetimepicker .xdsoft_next,
|
@@ -119,7 +119,7 @@
|
|
119
119
|
.xdsoft_datetimepicker .xdsoft_today_button{
|
120
120
|
background-color: transparent;
|
121
121
|
background-repeat: no-repeat;
|
122
|
-
border:
|
122
|
+
border: 0 none currentColor;
|
123
123
|
cursor: pointer;
|
124
124
|
display: block;
|
125
125
|
height: 30px;
|
@@ -127,7 +127,7 @@
|
|
127
127
|
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
128
128
|
outline: medium none currentColor;
|
129
129
|
overflow: hidden;
|
130
|
-
padding:
|
130
|
+
padding: 0;
|
131
131
|
position: relative;
|
132
132
|
text-indent: 100%;
|
133
133
|
white-space: nowrap;
|
@@ -144,9 +144,9 @@
|
|
144
144
|
margin-top:7px;
|
145
145
|
}
|
146
146
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev{
|
147
|
-
background-position:-40px
|
147
|
+
background-position:-40px 0;
|
148
148
|
margin-bottom:7px;
|
149
|
-
margin-top:
|
149
|
+
margin-top: 0;
|
150
150
|
}
|
151
151
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box{
|
152
152
|
height:151px;
|
@@ -161,13 +161,13 @@
|
|
161
161
|
text-align: center;
|
162
162
|
border-collapse:collapse;
|
163
163
|
cursor:pointer;
|
164
|
-
border-bottom-width:
|
164
|
+
border-bottom-width: 0;
|
165
165
|
height:25px;
|
166
166
|
line-height:25px;
|
167
167
|
}
|
168
168
|
|
169
169
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{
|
170
|
-
border-top-width:
|
170
|
+
border-top-width: 0;
|
171
171
|
}
|
172
172
|
.xdsoft_datetimepicker .xdsoft_today_button:hover,
|
173
173
|
.xdsoft_datetimepicker .xdsoft_next:hover,
|
@@ -199,7 +199,7 @@
|
|
199
199
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select{
|
200
200
|
border:1px solid #ccc;
|
201
201
|
position:absolute;
|
202
|
-
right:
|
202
|
+
right: 0;
|
203
203
|
top:30px;
|
204
204
|
z-index:101;
|
205
205
|
display:none;
|
@@ -219,7 +219,7 @@
|
|
219
219
|
}
|
220
220
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
|
221
221
|
background: #33AAFF;
|
222
|
-
box-shadow: #178FE5
|
222
|
+
box-shadow: #178FE5 0 1px 3px 0 inset;
|
223
223
|
color:#fff;
|
224
224
|
font-weight: 700;
|
225
225
|
}
|
@@ -253,7 +253,7 @@
|
|
253
253
|
font-size: 12px;
|
254
254
|
text-align: right;
|
255
255
|
vertical-align: middle;
|
256
|
-
padding:
|
256
|
+
padding: 0;
|
257
257
|
border-collapse:collapse;
|
258
258
|
cursor:pointer;
|
259
259
|
height: 25px;
|
@@ -271,7 +271,7 @@
|
|
271
271
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
|
272
272
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
|
273
273
|
background: #33AAFF;
|
274
|
-
box-shadow: #178FE5
|
274
|
+
box-shadow: #178FE5 0 1px 3px 0 inset;
|
275
275
|
color:#fff;
|
276
276
|
font-weight: 700;
|
277
277
|
}
|
@@ -320,9 +320,9 @@
|
|
320
320
|
.xdsoft_scrollbar{
|
321
321
|
position:absolute;
|
322
322
|
width:7px;
|
323
|
-
right:
|
324
|
-
top:
|
325
|
-
bottom:
|
323
|
+
right: 0;
|
324
|
+
top: 0;
|
325
|
+
bottom: 0;
|
326
326
|
cursor:pointer;
|
327
327
|
}
|
328
328
|
.xdsoft_scroller_box{
|
@@ -331,7 +331,7 @@ position:relative;
|
|
331
331
|
|
332
332
|
|
333
333
|
.xdsoft_datetimepicker.xdsoft_dark{
|
334
|
-
box-shadow:
|
334
|
+
box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
|
335
335
|
background: #000000;
|
336
336
|
border-bottom: 1px solid #444444;
|
337
337
|
border-left: 1px solid #333333;
|
@@ -364,7 +364,7 @@ position:relative;
|
|
364
364
|
|
365
365
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
|
366
366
|
background: #cc5500;
|
367
|
-
box-shadow: #b03e00
|
367
|
+
box-shadow: #b03e00 0 1px 3px 0 inset;
|
368
368
|
color:#000;
|
369
369
|
}
|
370
370
|
|
@@ -392,7 +392,7 @@ position:relative;
|
|
392
392
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
|
393
393
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
|
394
394
|
background: #cc5500;
|
395
|
-
box-shadow: #b03e00
|
395
|
+
box-shadow: #b03e00 0 1px 3px 0 inset;
|
396
396
|
color:#000;
|
397
397
|
}
|
398
398
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xdan-datetimepicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Kovach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.4.
|
104
|
+
rubygems_version: 2.4.6
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: XDan's jQuery DateTimePicker packaged for the Rails Asset Pipeline
|