ffoundation_datepicker_rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ffoundation_datepicker_rails/version.rb +1 -1
- data/vendor/assets/javascripts/foundation-datepicker-rails.js +1320 -1197
- data/vendor/assets/javascripts/locales/foundation-datepicker.ar.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.az.js +12 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.bg.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.bs.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ca.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.cs.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.cy.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.da.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.de.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.el.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.en-GB.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.eo.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.es.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.et.js +18 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.eu.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.fa.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.fi.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.fo.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.fr-CH.js +20 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.fr.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.gl.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.he.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.hr.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.hu.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.hy.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.id.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.is.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.it-CH.js +20 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.it.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ja.js +16 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ka.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.kh.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.kk.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ko.js +18 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.kr.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.lt.js +16 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.lv.js +16 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.me.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.mk.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.mn.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ms.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.nb.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.nl-BE.js +17 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.nl.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.no.js +13 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.pl.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.pt-br.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.pt.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ro.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.rs-latin.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.rs.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.ru.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sk.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sl.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sq.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sr-latin.js +16 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sr.js +16 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sv.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.sw.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.th.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.tr.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.uk.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.vi.js +15 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.zh-CN.js +14 -0
- data/vendor/assets/javascripts/locales/foundation-datepicker.zh-TW.js +14 -0
- metadata +67 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a033b984d015ad1e88f197630543397fdafa2e7
|
4
|
+
data.tar.gz: 9792037b4544b7c5649fbc97b9e879c5737a97b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f97323b8fd813598cf3478dd852816515710cd603fe5ff1508fb3f60f193116ff435a7890a5f8e988b596f513e6d1d0a3bcb727d886c22c11820f65f345a4c6e
|
7
|
+
data.tar.gz: e3e6879ad6f4b5ccbe5ef3b3483fcbd5b4ee76255eeb4372efbfe673d46e774b60d570777c9c2b58f05ef39abca8b2113c33566db3e656be0b034a55149deafe
|
@@ -3,1200 +3,1323 @@
|
|
3
3
|
* Copyright 2015 Peter Beno, najlepsiwebdesigner@gmail.com, @benopeter
|
4
4
|
* project website http://foundation-datepicker.peterbeno.com
|
5
5
|
* ========================================================= */
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
6
|
+
! function($) {
|
7
|
+
|
8
|
+
function UTCDate() {
|
9
|
+
return new Date(Date.UTC.apply(Date, arguments));
|
10
|
+
}
|
11
|
+
|
12
|
+
function UTCToday() {
|
13
|
+
var today = new Date();
|
14
|
+
return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
|
15
|
+
}
|
16
|
+
|
17
|
+
var Datepicker = function(element, options) {
|
18
|
+
var that = this;
|
19
|
+
|
20
|
+
this.element = $(element);
|
21
|
+
this.autoShow = options.autoShow || true;
|
22
|
+
this.appendTo = options.appendTo || 'body';
|
23
|
+
this.closeButton = options.closeButton;
|
24
|
+
this.language = options.language || this.element.data('date-language') || "en";
|
25
|
+
this.language = this.language in dates ? this.language : this.language.split('-')[0]; //Check if "de-DE" style date is available, if not language should fallback to 2 letter code eg "de"
|
26
|
+
this.language = this.language in dates ? this.language : "en";
|
27
|
+
this.isRTL = dates[this.language].rtl || false;
|
28
|
+
this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || dates[this.language].format || 'mm/dd/yyyy');
|
29
|
+
this.isInline = false;
|
30
|
+
this.isInput = this.element.is('input');
|
31
|
+
this.component = this.element.is('.date') ? this.element.find('.prefix, .postfix') : false;
|
32
|
+
this.hasInput = this.component && this.element.find('input').length;
|
33
|
+
this.disableDblClickSelection = options.disableDblClickSelection;
|
34
|
+
this.onRender = options.onRender || function() {};
|
35
|
+
if (this.component && this.component.length === 0) {
|
36
|
+
this.component = false;
|
37
|
+
}
|
38
|
+
this.linkField = options.linkField || this.element.data('link-field') || false;
|
39
|
+
this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || 'yyyy-mm-dd hh:ii:ss');
|
40
|
+
this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5;
|
41
|
+
this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right';
|
42
|
+
|
43
|
+
this._attachEvents();
|
44
|
+
|
45
|
+
|
46
|
+
this.minView = 0;
|
47
|
+
if ('minView' in options) {
|
48
|
+
this.minView = options.minView;
|
49
|
+
} else if ('minView' in this.element.data()) {
|
50
|
+
this.minView = this.element.data('min-view');
|
51
|
+
}
|
52
|
+
this.minView = DPGlobal.convertViewMode(this.minView);
|
53
|
+
|
54
|
+
this.maxView = DPGlobal.modes.length - 1;
|
55
|
+
if ('maxView' in options) {
|
56
|
+
this.maxView = options.maxView;
|
57
|
+
} else if ('maxView' in this.element.data()) {
|
58
|
+
this.maxView = this.element.data('max-view');
|
59
|
+
}
|
60
|
+
this.maxView = DPGlobal.convertViewMode(this.maxView);
|
61
|
+
|
62
|
+
this.startViewMode = 'month';
|
63
|
+
if ('startView' in options) {
|
64
|
+
this.startViewMode = options.startView;
|
65
|
+
} else if ('startView' in this.element.data()) {
|
66
|
+
this.startViewMode = this.element.data('start-view');
|
67
|
+
}
|
68
|
+
this.startViewMode = DPGlobal.convertViewMode(this.startViewMode);
|
69
|
+
this.viewMode = this.startViewMode;
|
70
|
+
|
71
|
+
if (!('minView' in options) && !('maxView' in options) && !(this.element.data('min-view') && !(this.element.data('max-view')))) {
|
72
|
+
this.pickTime = false;
|
73
|
+
if ('pickTime' in options) {
|
74
|
+
this.pickTime = options.pickTime;
|
75
|
+
}
|
76
|
+
if (this.pickTime == true) {
|
77
|
+
this.minView = 0;
|
78
|
+
this.maxView = 4;
|
79
|
+
} else {
|
80
|
+
this.minView = 2;
|
81
|
+
this.maxView = 4;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
this.forceParse = true;
|
86
|
+
if ('forceParse' in options) {
|
87
|
+
this.forceParse = options.forceParse;
|
88
|
+
} else if ('dateForceParse' in this.element.data()) {
|
89
|
+
this.forceParse = this.element.data('date-force-parse');
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
this.picker = $(DPGlobal.template)
|
94
|
+
.appendTo(this.isInline ? this.element : this.appendTo)
|
95
|
+
.on({
|
96
|
+
click: $.proxy(this.click, this),
|
97
|
+
mousedown: $.proxy(this.mousedown, this)
|
98
|
+
});
|
99
|
+
if (this.closeButton) {
|
100
|
+
this.picker.find('a.datepicker-close').show();
|
101
|
+
} else {
|
102
|
+
this.picker.find('a.datepicker-close').hide();
|
103
|
+
}
|
104
|
+
|
105
|
+
if (this.isInline) {
|
106
|
+
this.picker.addClass('datepicker-inline');
|
107
|
+
} else {
|
108
|
+
this.picker.addClass('datepicker-dropdown dropdown-menu');
|
109
|
+
}
|
110
|
+
if (this.isRTL) {
|
111
|
+
this.picker.addClass('datepicker-rtl');
|
112
|
+
this.picker.find('.prev i, .next i')
|
113
|
+
.toggleClass('fa fa-chevron-left fa-chevron-right').toggleClass('fa-chevron-left fa-chevron-right');
|
114
|
+
}
|
115
|
+
$(document).on('mousedown', function(e) {
|
116
|
+
// Clicked outside the datepicker, hide it
|
117
|
+
if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
|
118
|
+
that.hide();
|
119
|
+
}
|
120
|
+
});
|
121
|
+
|
122
|
+
this.autoclose = true;
|
123
|
+
if ('autoclose' in options) {
|
124
|
+
this.autoclose = options.autoclose;
|
125
|
+
} else if ('dateAutoclose' in this.element.data()) {
|
126
|
+
this.autoclose = this.element.data('date-autoclose');
|
127
|
+
}
|
128
|
+
|
129
|
+
this.keyboardNavigation = true;
|
130
|
+
if ('keyboardNavigation' in options) {
|
131
|
+
this.keyboardNavigation = options.keyboardNavigation;
|
132
|
+
} else if ('dateKeyboardNavigation' in this.element.data()) {
|
133
|
+
this.keyboardNavigation = this.element.data('date-keyboard-navigation');
|
134
|
+
}
|
135
|
+
|
136
|
+
this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false);
|
137
|
+
this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false);
|
138
|
+
|
139
|
+
this.calendarWeeks = false;
|
140
|
+
if ('calendarWeeks' in options) {
|
141
|
+
this.calendarWeeks = options.calendarWeeks;
|
142
|
+
} else if ('dateCalendarWeeks' in this.element.data()) {
|
143
|
+
this.calendarWeeks = this.element.data('date-calendar-weeks');
|
144
|
+
}
|
145
|
+
if (this.calendarWeeks)
|
146
|
+
this.picker.find('tfoot th.today')
|
147
|
+
.attr('colspan', function(i, val) {
|
148
|
+
return parseInt(val) + 1;
|
149
|
+
});
|
150
|
+
|
151
|
+
this.weekStart = ((options.weekStart || this.element.data('date-weekstart') || dates[this.language].weekStart || 0) % 7);
|
152
|
+
this.weekEnd = ((this.weekStart + 6) % 7);
|
153
|
+
this.startDate = -Infinity;
|
154
|
+
this.endDate = Infinity;
|
155
|
+
this.daysOfWeekDisabled = [];
|
156
|
+
this.setStartDate(options.startDate || this.element.data('date-startdate'));
|
157
|
+
this.setEndDate(options.endDate || this.element.data('date-enddate'));
|
158
|
+
this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled'));
|
159
|
+
|
160
|
+
this.fillDow();
|
161
|
+
this.fillMonths();
|
162
|
+
this.update();
|
163
|
+
|
164
|
+
this.showMode();
|
165
|
+
|
166
|
+
if (this.isInline) {
|
167
|
+
this.show();
|
168
|
+
}
|
169
|
+
};
|
170
|
+
|
171
|
+
Datepicker.prototype = {
|
172
|
+
constructor: Datepicker,
|
173
|
+
|
174
|
+
_events: [],
|
175
|
+
_attachEvents: function() {
|
176
|
+
this._detachEvents();
|
177
|
+
if (this.isInput) { // single input
|
178
|
+
this._events = [
|
179
|
+
[this.element, {
|
180
|
+
focus: (this.autoShow) ? $.proxy(this.show, this) : function() {},
|
181
|
+
keyup: $.proxy(this.update, this),
|
182
|
+
keydown: $.proxy(this.keydown, this)
|
183
|
+
}]
|
184
|
+
];
|
185
|
+
} else if (this.component && this.hasInput) { // component: input + button
|
186
|
+
this._events = [
|
187
|
+
// For components that are not readonly, allow keyboard nav
|
188
|
+
[this.element.find('input'), {
|
189
|
+
focus: (this.autoShow) ? $.proxy(this.show, this) : function() {},
|
190
|
+
keyup: $.proxy(this.update, this),
|
191
|
+
keydown: $.proxy(this.keydown, this)
|
192
|
+
}],
|
193
|
+
[this.component, {
|
194
|
+
click: $.proxy(this.show, this)
|
195
|
+
}]
|
196
|
+
];
|
197
|
+
} else if (this.element.is('div')) { // inline datepicker
|
198
|
+
this.isInline = true;
|
199
|
+
} else {
|
200
|
+
this._events = [
|
201
|
+
[this.element, {
|
202
|
+
click: $.proxy(this.show, this)
|
203
|
+
}]
|
204
|
+
];
|
205
|
+
}
|
206
|
+
|
207
|
+
if (this.disableDblClickSelection) {
|
208
|
+
this._events[this._events.length] = [
|
209
|
+
this.element, {
|
210
|
+
dblclick: function(e) {
|
211
|
+
e.preventDefault();
|
212
|
+
e.stopPropagation();
|
213
|
+
$(this).blur()
|
214
|
+
}
|
215
|
+
}
|
216
|
+
];
|
217
|
+
}
|
218
|
+
|
219
|
+
for (var i = 0, el, ev; i < this._events.length; i++) {
|
220
|
+
el = this._events[i][0];
|
221
|
+
ev = this._events[i][1];
|
222
|
+
el.on(ev);
|
223
|
+
}
|
224
|
+
},
|
225
|
+
_detachEvents: function() {
|
226
|
+
for (var i = 0, el, ev; i < this._events.length; i++) {
|
227
|
+
el = this._events[i][0];
|
228
|
+
ev = this._events[i][1];
|
229
|
+
el.off(ev);
|
230
|
+
}
|
231
|
+
this._events = [];
|
232
|
+
},
|
233
|
+
|
234
|
+
show: function(e) {
|
235
|
+
this.picker.show();
|
236
|
+
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
|
237
|
+
this.update();
|
238
|
+
this.place();
|
239
|
+
$(window).on('resize', $.proxy(this.place, this));
|
240
|
+
if (e) {
|
241
|
+
e.stopPropagation();
|
242
|
+
e.preventDefault();
|
243
|
+
}
|
244
|
+
this.element.trigger({
|
245
|
+
type: 'show',
|
246
|
+
date: this.date
|
247
|
+
});
|
248
|
+
},
|
249
|
+
|
250
|
+
hide: function(e) {
|
251
|
+
if (this.isInline) return;
|
252
|
+
if (!this.picker.is(':visible')) return;
|
253
|
+
this.picker.hide();
|
254
|
+
$(window).off('resize', this.place);
|
255
|
+
this.viewMode = this.startViewMode;
|
256
|
+
this.showMode();
|
257
|
+
if (!this.isInput) {
|
258
|
+
$(document).off('mousedown', this.hide);
|
259
|
+
}
|
260
|
+
|
261
|
+
if (
|
262
|
+
this.forceParse &&
|
263
|
+
(
|
264
|
+
this.isInput && this.element.val() ||
|
265
|
+
this.hasInput && this.element.find('input').val()
|
266
|
+
)
|
267
|
+
)
|
268
|
+
this.setValue();
|
269
|
+
this.element.trigger({
|
270
|
+
type: 'hide',
|
271
|
+
date: this.date
|
272
|
+
});
|
273
|
+
},
|
274
|
+
|
275
|
+
remove: function() {
|
276
|
+
this._detachEvents();
|
277
|
+
this.picker.remove();
|
278
|
+
delete this.element.data().datepicker;
|
279
|
+
},
|
280
|
+
|
281
|
+
getDate: function() {
|
282
|
+
var d = this.getUTCDate();
|
283
|
+
return new Date(d.getTime() + (d.getTimezoneOffset() * 60000));
|
284
|
+
},
|
285
|
+
|
286
|
+
getUTCDate: function() {
|
287
|
+
return this.date;
|
288
|
+
},
|
289
|
+
|
290
|
+
setDate: function(d) {
|
291
|
+
this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000)));
|
292
|
+
},
|
293
|
+
|
294
|
+
setUTCDate: function(d) {
|
295
|
+
this.date = d;
|
296
|
+
this.setValue();
|
297
|
+
},
|
298
|
+
|
299
|
+
setValue: function() {
|
300
|
+
var formatted = this.getFormattedDate();
|
301
|
+
if (!this.isInput) {
|
302
|
+
if (this.component) {
|
303
|
+
this.element.find('input').val(formatted);
|
304
|
+
}
|
305
|
+
this.element.data('date', formatted);
|
306
|
+
} else {
|
307
|
+
this.element.val(formatted);
|
308
|
+
}
|
309
|
+
},
|
310
|
+
|
311
|
+
getFormattedDate: function(format) {
|
312
|
+
if (format === undefined)
|
313
|
+
format = this.format;
|
314
|
+
return DPGlobal.formatDate(this.date, format, this.language);
|
315
|
+
},
|
316
|
+
|
317
|
+
setStartDate: function(startDate) {
|
318
|
+
this.startDate = startDate || -Infinity;
|
319
|
+
if (this.startDate !== -Infinity) {
|
320
|
+
this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language);
|
321
|
+
}
|
322
|
+
this.update();
|
323
|
+
this.updateNavArrows();
|
324
|
+
},
|
325
|
+
|
326
|
+
setEndDate: function(endDate) {
|
327
|
+
this.endDate = endDate || Infinity;
|
328
|
+
if (this.endDate !== Infinity) {
|
329
|
+
this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language);
|
330
|
+
}
|
331
|
+
this.update();
|
332
|
+
this.updateNavArrows();
|
333
|
+
},
|
334
|
+
|
335
|
+
setDaysOfWeekDisabled: function(daysOfWeekDisabled) {
|
336
|
+
this.daysOfWeekDisabled = daysOfWeekDisabled || [];
|
337
|
+
if (!$.isArray(this.daysOfWeekDisabled)) {
|
338
|
+
this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
|
339
|
+
}
|
340
|
+
this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function(d) {
|
341
|
+
return parseInt(d, 10);
|
342
|
+
});
|
343
|
+
this.update();
|
344
|
+
this.updateNavArrows();
|
345
|
+
},
|
346
|
+
|
347
|
+
place: function() {
|
348
|
+
if (this.isInline) return;
|
349
|
+
var zIndex = parseInt(this.element.parents().filter(function() {
|
350
|
+
return $(this).css('z-index') != 'auto';
|
351
|
+
}).first().css('z-index')) + 10;
|
352
|
+
var textbox = this.component ? this.component : this.element;
|
353
|
+
var offset = textbox.offset();
|
354
|
+
var height = textbox.outerHeight() + parseInt(textbox.css('margin-top'));
|
355
|
+
var width = textbox.outerWidth() + parseInt(textbox.css('margin-left'));
|
356
|
+
var fullOffsetTop = offset.top + height;
|
357
|
+
var offsetLeft = offset.left;
|
358
|
+
// if the datepicker is going to be below the window, show it on top of the input
|
359
|
+
if ((fullOffsetTop + this.picker.outerHeight()) >= $(window).scrollTop() + $(window).height()) {
|
360
|
+
fullOffsetTop = offset.top - this.picker.outerHeight();
|
361
|
+
}
|
362
|
+
|
363
|
+
// if the datepicker is going to go past the right side of the window, we want
|
364
|
+
// to set the right position so the datepicker lines up with the textbox
|
365
|
+
if (offset.left + this.picker.width() >= $(window).width()) {
|
366
|
+
offsetLeft = (offset.left + width) - this.picker.width();
|
367
|
+
}
|
368
|
+
this.picker.css({
|
369
|
+
top: fullOffsetTop,
|
370
|
+
left: offsetLeft,
|
371
|
+
zIndex: zIndex
|
372
|
+
});
|
373
|
+
},
|
374
|
+
|
375
|
+
update: function() {
|
376
|
+
var date, fromArgs = false;
|
377
|
+
if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
|
378
|
+
date = arguments[0];
|
379
|
+
fromArgs = true;
|
380
|
+
} else {
|
381
|
+
date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
|
382
|
+
}
|
383
|
+
|
384
|
+
this.date = DPGlobal.parseDate(date, this.format, this.language);
|
385
|
+
|
386
|
+
if (fromArgs) this.setValue();
|
387
|
+
|
388
|
+
if (this.date < this.startDate) {
|
389
|
+
this.viewDate = new Date(this.startDate.valueOf());
|
390
|
+
} else if (this.date > this.endDate) {
|
391
|
+
this.viewDate = new Date(this.endDate.valueOf());
|
392
|
+
} else {
|
393
|
+
this.viewDate = new Date(this.date.valueOf());
|
394
|
+
}
|
395
|
+
this.fill();
|
396
|
+
},
|
397
|
+
|
398
|
+
fillDow: function() {
|
399
|
+
var dowCnt = this.weekStart,
|
400
|
+
html = '<tr>';
|
401
|
+
if (this.calendarWeeks) {
|
402
|
+
var cell = '<th class="cw"> </th>';
|
403
|
+
html += cell;
|
404
|
+
this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
|
405
|
+
}
|
406
|
+
while (dowCnt < this.weekStart + 7) {
|
407
|
+
html += '<th class="dow">' + dates[this.language].daysMin[(dowCnt++) % 7] + '</th>';
|
408
|
+
}
|
409
|
+
html += '</tr>';
|
410
|
+
this.picker.find('.datepicker-days thead').append(html);
|
411
|
+
},
|
412
|
+
|
413
|
+
fillMonths: function() {
|
414
|
+
var html = '',
|
415
|
+
i = 0;
|
416
|
+
while (i < 12) {
|
417
|
+
html += '<span class="month">' + dates[this.language].monthsShort[i++] + '</span>';
|
418
|
+
}
|
419
|
+
this.picker.find('.datepicker-months td').html(html);
|
420
|
+
},
|
421
|
+
|
422
|
+
fill: function() {
|
423
|
+
if (this.date == null || this.viewDate == null) {
|
424
|
+
return;
|
425
|
+
}
|
426
|
+
|
427
|
+
var d = new Date(this.viewDate.valueOf()),
|
428
|
+
year = d.getUTCFullYear(),
|
429
|
+
month = d.getUTCMonth(),
|
430
|
+
dayMonth = d.getUTCDate(),
|
431
|
+
hours = d.getUTCHours(),
|
432
|
+
minutes = d.getUTCMinutes(),
|
433
|
+
startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
|
434
|
+
startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
|
435
|
+
endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
|
436
|
+
endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
|
437
|
+
currentDate = this.date && this.date.valueOf(),
|
438
|
+
today = new Date(),
|
439
|
+
titleFormat = dates[this.language].titleFormat || dates['en'].titleFormat;
|
440
|
+
// this.picker.find('.datepicker-days thead th.date-switch')
|
441
|
+
// .text(DPGlobal.formatDate(new UTCDate(year, month), titleFormat, this.language));
|
442
|
+
|
443
|
+
this.picker.find('.datepicker-days thead th:eq(1)')
|
444
|
+
.text(dates[this.language].months[month] + ' ' + year);
|
445
|
+
this.picker.find('.datepicker-hours thead th:eq(1)')
|
446
|
+
.text(dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);
|
447
|
+
this.picker.find('.datepicker-minutes thead th:eq(1)')
|
448
|
+
.text(dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);
|
449
|
+
|
450
|
+
|
451
|
+
this.picker.find('tfoot th.today')
|
452
|
+
.text(dates[this.language].today)
|
453
|
+
.toggle(this.todayBtn !== false);
|
454
|
+
this.updateNavArrows();
|
455
|
+
this.fillMonths();
|
456
|
+
var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0),
|
457
|
+
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
|
458
|
+
prevMonth.setUTCDate(day);
|
459
|
+
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);
|
460
|
+
var nextMonth = new Date(prevMonth.valueOf());
|
461
|
+
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
|
462
|
+
nextMonth = nextMonth.valueOf();
|
463
|
+
var html = [];
|
464
|
+
var clsName;
|
465
|
+
while (prevMonth.valueOf() < nextMonth) {
|
466
|
+
if (prevMonth.getUTCDay() == this.weekStart) {
|
467
|
+
html.push('<tr>');
|
468
|
+
if (this.calendarWeeks) {
|
469
|
+
// adapted from https://github.com/timrwood/moment/blob/master/moment.js#L128
|
470
|
+
var a = new Date(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth(), prevMonth.getUTCDate() - prevMonth.getDay() + 10 - (this.weekStart && this.weekStart % 7 < 5 && 7)),
|
471
|
+
b = new Date(a.getFullYear(), 0, 4),
|
472
|
+
calWeek = ~~((a - b) / 864e5 / 7 + 1.5);
|
473
|
+
html.push('<td class="cw">' + calWeek + '</td>');
|
474
|
+
}
|
475
|
+
}
|
476
|
+
clsName = ' ' + this.onRender(prevMonth) + ' ';
|
477
|
+
if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
|
478
|
+
clsName += ' old';
|
479
|
+
} else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
|
480
|
+
clsName += ' new';
|
481
|
+
}
|
482
|
+
// Compare internal UTC date with local today, not UTC today
|
483
|
+
if (this.todayHighlight &&
|
484
|
+
prevMonth.getUTCFullYear() == today.getFullYear() &&
|
485
|
+
prevMonth.getUTCMonth() == today.getMonth() &&
|
486
|
+
prevMonth.getUTCDate() == today.getDate()) {
|
487
|
+
clsName += ' today';
|
488
|
+
}
|
489
|
+
if (currentDate && prevMonth.valueOf() == currentDate) {
|
490
|
+
clsName += ' active';
|
491
|
+
}
|
492
|
+
if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
|
493
|
+
$.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) {
|
494
|
+
clsName += ' disabled';
|
495
|
+
}
|
496
|
+
html.push('<td class="day' + clsName + '">' + prevMonth.getUTCDate() + '</td>');
|
497
|
+
if (prevMonth.getUTCDay() == this.weekEnd) {
|
498
|
+
html.push('</tr>');
|
499
|
+
}
|
500
|
+
prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
|
501
|
+
}
|
502
|
+
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
|
503
|
+
|
504
|
+
html = [];
|
505
|
+
for (var i = 0; i < 24; i++) {
|
506
|
+
var actual = UTCDate(year, month, dayMonth, i);
|
507
|
+
clsName = '';
|
508
|
+
// We want the previous hour for the startDate
|
509
|
+
if ((actual.valueOf() + 3600000) < this.startDate || actual.valueOf() > this.endDate) {
|
510
|
+
clsName += ' disabled';
|
511
|
+
} else if (hours == i) {
|
512
|
+
clsName += ' active';
|
513
|
+
}
|
514
|
+
html.push('<span class="hour' + clsName + '">' + i + ':00</span>');
|
515
|
+
}
|
516
|
+
this.picker.find('.datepicker-hours td').html(html.join(''));
|
517
|
+
|
518
|
+
html = [];
|
519
|
+
for (var i = 0; i < 60; i += this.minuteStep) {
|
520
|
+
var actual = UTCDate(year, month, dayMonth, hours, i);
|
521
|
+
clsName = '';
|
522
|
+
if (actual.valueOf() < this.startDate || actual.valueOf() > this.endDate) {
|
523
|
+
clsName += ' disabled';
|
524
|
+
} else if (Math.floor(minutes / this.minuteStep) == Math.floor(i / this.minuteStep)) {
|
525
|
+
clsName += ' active';
|
526
|
+
}
|
527
|
+
html.push('<span class="minute' + clsName + '">' + hours + ':' + (i < 10 ? '0' + i : i) + '</span>');
|
528
|
+
}
|
529
|
+
this.picker.find('.datepicker-minutes td').html(html.join(''));
|
530
|
+
|
531
|
+
|
532
|
+
var currentYear = this.date && this.date.getUTCFullYear();
|
533
|
+
var months = this.picker.find('.datepicker-months')
|
534
|
+
.find('th:eq(1)')
|
535
|
+
.text(year)
|
536
|
+
.end()
|
537
|
+
.find('span').removeClass('active');
|
538
|
+
if (currentYear && currentYear == year) {
|
539
|
+
months.eq(this.date.getUTCMonth()).addClass('active');
|
540
|
+
}
|
541
|
+
if (year < startYear || year > endYear) {
|
542
|
+
months.addClass('disabled');
|
543
|
+
}
|
544
|
+
if (year == startYear) {
|
545
|
+
months.slice(0, startMonth).addClass('disabled');
|
546
|
+
}
|
547
|
+
if (year == endYear) {
|
548
|
+
months.slice(endMonth + 1).addClass('disabled');
|
549
|
+
}
|
550
|
+
|
551
|
+
html = '';
|
552
|
+
year = parseInt(year / 10, 10) * 10;
|
553
|
+
var yearCont = this.picker.find('.datepicker-years')
|
554
|
+
.find('th:eq(1)')
|
555
|
+
.text(year + '-' + (year + 9))
|
556
|
+
.end()
|
557
|
+
.find('td');
|
558
|
+
year -= 1;
|
559
|
+
for (var i = -1; i < 11; i++) {
|
560
|
+
html += '<span class="year' + (i == -1 || i == 10 ? ' old' : '') + (currentYear == year ? ' active' : '') + (year < startYear || year > endYear ? ' disabled' : '') + '">' + year + '</span>';
|
561
|
+
year += 1;
|
562
|
+
}
|
563
|
+
yearCont.html(html);
|
564
|
+
},
|
565
|
+
|
566
|
+
updateNavArrows: function() {
|
567
|
+
var d = new Date(this.viewDate),
|
568
|
+
year = d.getUTCFullYear(),
|
569
|
+
month = d.getUTCMonth(),
|
570
|
+
day = d.getUTCDate(),
|
571
|
+
hour = d.getUTCHours();
|
572
|
+
switch (this.viewMode) {
|
573
|
+
case 0:
|
574
|
+
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth() && day <= this.startDate.getUTCDate() && hour <= this.startDate.getUTCHours()) {
|
575
|
+
this.picker.find('.prev').css({
|
576
|
+
visibility: 'hidden'
|
577
|
+
});
|
578
|
+
} else {
|
579
|
+
this.picker.find('.prev').css({
|
580
|
+
visibility: 'visible'
|
581
|
+
});
|
582
|
+
}
|
583
|
+
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth() && day >= this.endDate.getUTCDate() && hour >= this.endDate.getUTCHours()) {
|
584
|
+
this.picker.find('.next').css({
|
585
|
+
visibility: 'hidden'
|
586
|
+
});
|
587
|
+
} else {
|
588
|
+
this.picker.find('.next').css({
|
589
|
+
visibility: 'visible'
|
590
|
+
});
|
591
|
+
}
|
592
|
+
break;
|
593
|
+
case 1:
|
594
|
+
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth() && day <= this.startDate.getUTCDate()) {
|
595
|
+
this.picker.find('.prev').css({
|
596
|
+
visibility: 'hidden'
|
597
|
+
});
|
598
|
+
} else {
|
599
|
+
this.picker.find('.prev').css({
|
600
|
+
visibility: 'visible'
|
601
|
+
});
|
602
|
+
}
|
603
|
+
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth() && day >= this.endDate.getUTCDate()) {
|
604
|
+
this.picker.find('.next').css({
|
605
|
+
visibility: 'hidden'
|
606
|
+
});
|
607
|
+
} else {
|
608
|
+
this.picker.find('.next').css({
|
609
|
+
visibility: 'visible'
|
610
|
+
});
|
611
|
+
}
|
612
|
+
break;
|
613
|
+
case 2:
|
614
|
+
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
|
615
|
+
this.picker.find('.prev').css({
|
616
|
+
visibility: 'hidden'
|
617
|
+
});
|
618
|
+
} else {
|
619
|
+
this.picker.find('.prev').css({
|
620
|
+
visibility: 'visible'
|
621
|
+
});
|
622
|
+
}
|
623
|
+
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
|
624
|
+
this.picker.find('.next').css({
|
625
|
+
visibility: 'hidden'
|
626
|
+
});
|
627
|
+
} else {
|
628
|
+
this.picker.find('.next').css({
|
629
|
+
visibility: 'visible'
|
630
|
+
});
|
631
|
+
}
|
632
|
+
break;
|
633
|
+
case 3:
|
634
|
+
case 4:
|
635
|
+
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
|
636
|
+
this.picker.find('.prev').css({
|
637
|
+
visibility: 'hidden'
|
638
|
+
});
|
639
|
+
} else {
|
640
|
+
this.picker.find('.prev').css({
|
641
|
+
visibility: 'visible'
|
642
|
+
});
|
643
|
+
}
|
644
|
+
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
|
645
|
+
this.picker.find('.next').css({
|
646
|
+
visibility: 'hidden'
|
647
|
+
});
|
648
|
+
} else {
|
649
|
+
this.picker.find('.next').css({
|
650
|
+
visibility: 'visible'
|
651
|
+
});
|
652
|
+
}
|
653
|
+
break;
|
654
|
+
}
|
655
|
+
},
|
656
|
+
|
657
|
+
click: function(e) {
|
658
|
+
e.stopPropagation();
|
659
|
+
e.preventDefault();
|
660
|
+
|
661
|
+
if ($(e.target).hasClass('datepicker-close') || $(e.target).parent().hasClass('datepicker-close')) {
|
662
|
+
this.hide();
|
663
|
+
}
|
664
|
+
|
665
|
+
var target = $(e.target).closest('span, td, th');
|
666
|
+
if (target.length == 1) {
|
667
|
+
if (target.is('.disabled')) {
|
668
|
+
this.element.trigger({
|
669
|
+
type: 'outOfRange',
|
670
|
+
date: this.viewDate,
|
671
|
+
startDate: this.startDate,
|
672
|
+
endDate: this.endDate
|
673
|
+
});
|
674
|
+
return;
|
675
|
+
}
|
676
|
+
|
677
|
+
switch (target[0].nodeName.toLowerCase()) {
|
678
|
+
case 'th':
|
679
|
+
switch (target[0].className) {
|
680
|
+
case 'date-switch':
|
681
|
+
this.showMode(1);
|
682
|
+
break;
|
683
|
+
case 'prev':
|
684
|
+
case 'next':
|
685
|
+
var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
|
686
|
+
switch (this.viewMode) {
|
687
|
+
case 0:
|
688
|
+
this.viewDate = this.moveHour(this.viewDate, dir);
|
689
|
+
break;
|
690
|
+
case 1:
|
691
|
+
this.viewDate = this.moveDate(this.viewDate, dir);
|
692
|
+
break;
|
693
|
+
case 2:
|
694
|
+
this.viewDate = this.moveMonth(this.viewDate, dir);
|
695
|
+
break;
|
696
|
+
case 3:
|
697
|
+
case 4:
|
698
|
+
this.viewDate = this.moveYear(this.viewDate, dir);
|
699
|
+
break;
|
700
|
+
}
|
701
|
+
this.fill();
|
702
|
+
break;
|
703
|
+
case 'today':
|
704
|
+
var date = new Date();
|
705
|
+
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
|
706
|
+
|
707
|
+
this.viewMode = this.startViewMode;
|
708
|
+
this.showMode(0);
|
709
|
+
this._setDate(date);
|
710
|
+
break;
|
711
|
+
}
|
712
|
+
break;
|
713
|
+
case 'span':
|
714
|
+
if (!target.is('.disabled')) {
|
715
|
+
if (target.is('.month')) {
|
716
|
+
this.viewDate.setUTCDate(1);
|
717
|
+
var month = target.parent().find('span').index(target);
|
718
|
+
this.viewDate.setUTCMonth(month);
|
719
|
+
this.element.trigger({
|
720
|
+
type: 'changeMonth',
|
721
|
+
date: this.viewDate
|
722
|
+
});
|
723
|
+
} else if (target.is('.year')) {
|
724
|
+
this.viewDate.setUTCDate(1);
|
725
|
+
var year = parseInt(target.text(), 10) || 0;
|
726
|
+
this.viewDate.setUTCFullYear(year);
|
727
|
+
this.element.trigger({
|
728
|
+
type: 'changeYear',
|
729
|
+
date: this.viewDate
|
730
|
+
});
|
731
|
+
} else if (target.is('.hour')) {
|
732
|
+
var hours = parseInt(target.text(), 10) || 0;
|
733
|
+
var year = this.viewDate.getUTCFullYear(),
|
734
|
+
month = this.viewDate.getUTCMonth(),
|
735
|
+
day = this.viewDate.getUTCDate(),
|
736
|
+
minutes = this.viewDate.getUTCMinutes(),
|
737
|
+
seconds = this.viewDate.getUTCSeconds();
|
738
|
+
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
739
|
+
} else if (target.is('.minute')) {
|
740
|
+
var minutes = parseInt(target.text().substr(target.text().indexOf(':') + 1), 10) || 0;
|
741
|
+
var year = this.viewDate.getUTCFullYear(),
|
742
|
+
month = this.viewDate.getUTCMonth(),
|
743
|
+
day = this.viewDate.getUTCDate(),
|
744
|
+
hours = this.viewDate.getUTCHours(),
|
745
|
+
seconds = this.viewDate.getUTCSeconds();
|
746
|
+
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
747
|
+
}
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
if (this.viewMode != 0) {
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
var oldViewMode = this.viewMode;
|
756
|
+
this.showMode(-1);
|
757
|
+
this.fill();
|
758
|
+
if (oldViewMode == this.viewMode && this.autoclose) {
|
759
|
+
this.hide();
|
760
|
+
}
|
761
|
+
} else {
|
762
|
+
this.fill();
|
763
|
+
if (this.autoclose) {
|
764
|
+
this.hide();
|
765
|
+
}
|
766
|
+
}
|
767
|
+
}
|
768
|
+
break;
|
769
|
+
case 'td':
|
770
|
+
|
771
|
+
|
772
|
+
|
773
|
+
if (target.is('.day') && !target.is('.disabled')) {
|
774
|
+
var day = parseInt(target.text(), 10) || 1;
|
775
|
+
var year = this.viewDate.getUTCFullYear(),
|
776
|
+
month = this.viewDate.getUTCMonth(),
|
777
|
+
hours = this.viewDate.getUTCHours(),
|
778
|
+
minutes = this.viewDate.getUTCMinutes(),
|
779
|
+
seconds = this.viewDate.getUTCSeconds();
|
780
|
+
if (target.is('.old')) {
|
781
|
+
if (month === 0) {
|
782
|
+
month = 11;
|
783
|
+
year -= 1;
|
784
|
+
} else {
|
785
|
+
month -= 1;
|
786
|
+
}
|
787
|
+
} else if (target.is('.new')) {
|
788
|
+
if (month == 11) {
|
789
|
+
month = 0;
|
790
|
+
year += 1;
|
791
|
+
} else {
|
792
|
+
month += 1;
|
793
|
+
}
|
794
|
+
}
|
795
|
+
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
796
|
+
}
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
var oldViewMode = this.viewMode;
|
801
|
+
|
802
|
+
|
803
|
+
this.showMode(-1);
|
804
|
+
|
805
|
+
|
806
|
+
this.fill();
|
807
|
+
if (oldViewMode == this.viewMode && this.autoclose) {
|
808
|
+
this.hide();
|
809
|
+
}
|
810
|
+
break;
|
811
|
+
}
|
812
|
+
}
|
813
|
+
},
|
814
|
+
|
815
|
+
_setDate: function(date, which) {
|
816
|
+
|
817
|
+
if (!which || which == 'date')
|
818
|
+
this.date = date;
|
819
|
+
if (!which || which == 'view')
|
820
|
+
this.viewDate = date;
|
821
|
+
this.fill();
|
822
|
+
this.setValue();
|
823
|
+
this.element.trigger({
|
824
|
+
type: 'changeDate',
|
825
|
+
date: this.date
|
826
|
+
});
|
827
|
+
var element;
|
828
|
+
if (this.isInput) {
|
829
|
+
element = this.element;
|
830
|
+
} else if (this.component) {
|
831
|
+
element = this.element.find('input');
|
832
|
+
}
|
833
|
+
if (element) {
|
834
|
+
element.change();
|
835
|
+
if (this.autoclose && (!which || which == 'date')) {
|
836
|
+
// this.hide();
|
837
|
+
}
|
838
|
+
}
|
839
|
+
},
|
840
|
+
|
841
|
+
moveHour: function(date, dir) {
|
842
|
+
if (!dir) return date;
|
843
|
+
var new_date = new Date(date.valueOf());
|
844
|
+
dir = dir > 0 ? 1 : -1;
|
845
|
+
new_date.setUTCHours(new_date.getUTCHours() + dir);
|
846
|
+
return new_date;
|
847
|
+
},
|
848
|
+
|
849
|
+
moveDate: function(date, dir) {
|
850
|
+
if (!dir) return date;
|
851
|
+
var new_date = new Date(date.valueOf());
|
852
|
+
dir = dir > 0 ? 1 : -1;
|
853
|
+
new_date.setUTCDate(new_date.getUTCDate() + dir);
|
854
|
+
return new_date;
|
855
|
+
},
|
856
|
+
|
857
|
+
moveMonth: function(date, dir) {
|
858
|
+
if (!dir) return date;
|
859
|
+
var new_date = new Date(date.valueOf()),
|
860
|
+
day = new_date.getUTCDate(),
|
861
|
+
month = new_date.getUTCMonth(),
|
862
|
+
mag = Math.abs(dir),
|
863
|
+
new_month, test;
|
864
|
+
dir = dir > 0 ? 1 : -1;
|
865
|
+
if (mag == 1) {
|
866
|
+
test = dir == -1
|
867
|
+
// If going back one month, make sure month is not current month
|
868
|
+
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
|
869
|
+
? function() {
|
870
|
+
return new_date.getUTCMonth() == month;
|
871
|
+
}
|
872
|
+
// If going forward one month, make sure month is as expected
|
873
|
+
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
|
874
|
+
: function() {
|
875
|
+
return new_date.getUTCMonth() != new_month;
|
876
|
+
};
|
877
|
+
new_month = month + dir;
|
878
|
+
new_date.setUTCMonth(new_month);
|
879
|
+
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
|
880
|
+
if (new_month < 0 || new_month > 11)
|
881
|
+
new_month = (new_month + 12) % 12;
|
882
|
+
} else {
|
883
|
+
// For magnitudes >1, move one month at a time...
|
884
|
+
for (var i = 0; i < mag; i++)
|
885
|
+
// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
|
886
|
+
new_date = this.moveMonth(new_date, dir);
|
887
|
+
// ...then reset the day, keeping it in the new month
|
888
|
+
new_month = new_date.getUTCMonth();
|
889
|
+
new_date.setUTCDate(day);
|
890
|
+
test = function() {
|
891
|
+
return new_month != new_date.getUTCMonth();
|
892
|
+
};
|
893
|
+
}
|
894
|
+
// Common date-resetting loop -- if date is beyond end of month, make it
|
895
|
+
// end of month
|
896
|
+
while (test()) {
|
897
|
+
new_date.setUTCDate(--day);
|
898
|
+
new_date.setUTCMonth(new_month);
|
899
|
+
}
|
900
|
+
return new_date;
|
901
|
+
},
|
902
|
+
|
903
|
+
moveYear: function(date, dir) {
|
904
|
+
return this.moveMonth(date, dir * 12);
|
905
|
+
},
|
906
|
+
|
907
|
+
dateWithinRange: function(date) {
|
908
|
+
return date >= this.startDate && date <= this.endDate;
|
909
|
+
},
|
910
|
+
|
911
|
+
keydown: function(e) {
|
912
|
+
if (this.picker.is(':not(:visible)')) {
|
913
|
+
if (e.keyCode == 27) // allow escape to hide and re-show picker
|
914
|
+
this.show();
|
915
|
+
return;
|
916
|
+
}
|
917
|
+
var dateChanged = false,
|
918
|
+
dir, day, month,
|
919
|
+
newDate, newViewDate;
|
920
|
+
switch (e.keyCode) {
|
921
|
+
case 27: // escape
|
922
|
+
this.hide();
|
923
|
+
e.preventDefault();
|
924
|
+
break;
|
925
|
+
case 37: // left
|
926
|
+
case 39: // right
|
927
|
+
if (!this.keyboardNavigation) break;
|
928
|
+
dir = e.keyCode == 37 ? -1 : 1;
|
929
|
+
if (e.ctrlKey) {
|
930
|
+
newDate = this.moveYear(this.date, dir);
|
931
|
+
newViewDate = this.moveYear(this.viewDate, dir);
|
932
|
+
} else if (e.shiftKey) {
|
933
|
+
newDate = this.moveMonth(this.date, dir);
|
934
|
+
newViewDate = this.moveMonth(this.viewDate, dir);
|
935
|
+
} else {
|
936
|
+
newDate = new Date(this.date.valueOf());
|
937
|
+
newDate.setUTCDate(this.date.getUTCDate() + dir);
|
938
|
+
newViewDate = new Date(this.viewDate.valueOf());
|
939
|
+
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
|
940
|
+
}
|
941
|
+
if (this.dateWithinRange(newDate)) {
|
942
|
+
this.date = newDate;
|
943
|
+
this.viewDate = newViewDate;
|
944
|
+
this.setValue();
|
945
|
+
this.update();
|
946
|
+
e.preventDefault();
|
947
|
+
dateChanged = true;
|
948
|
+
}
|
949
|
+
break;
|
950
|
+
case 38: // up
|
951
|
+
case 40: // down
|
952
|
+
if (!this.keyboardNavigation) break;
|
953
|
+
dir = e.keyCode == 38 ? -1 : 1;
|
954
|
+
if (e.ctrlKey) {
|
955
|
+
newDate = this.moveYear(this.date, dir);
|
956
|
+
newViewDate = this.moveYear(this.viewDate, dir);
|
957
|
+
} else if (e.shiftKey) {
|
958
|
+
newDate = this.moveMonth(this.date, dir);
|
959
|
+
newViewDate = this.moveMonth(this.viewDate, dir);
|
960
|
+
} else {
|
961
|
+
newDate = new Date(this.date.valueOf());
|
962
|
+
newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
|
963
|
+
newViewDate = new Date(this.viewDate.valueOf());
|
964
|
+
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
|
965
|
+
}
|
966
|
+
if (this.dateWithinRange(newDate)) {
|
967
|
+
this.date = newDate;
|
968
|
+
this.viewDate = newViewDate;
|
969
|
+
this.setValue();
|
970
|
+
this.update();
|
971
|
+
e.preventDefault();
|
972
|
+
dateChanged = true;
|
973
|
+
}
|
974
|
+
break;
|
975
|
+
case 13: // enter
|
976
|
+
this.hide();
|
977
|
+
e.preventDefault();
|
978
|
+
break;
|
979
|
+
case 9: // tab
|
980
|
+
this.hide();
|
981
|
+
break;
|
982
|
+
}
|
983
|
+
if (dateChanged) {
|
984
|
+
this.element.trigger({
|
985
|
+
type: 'changeDate',
|
986
|
+
date: this.date
|
987
|
+
});
|
988
|
+
var element;
|
989
|
+
if (this.isInput) {
|
990
|
+
element = this.element;
|
991
|
+
} else if (this.component) {
|
992
|
+
element = this.element.find('input');
|
993
|
+
}
|
994
|
+
if (element) {
|
995
|
+
element.change();
|
996
|
+
}
|
997
|
+
}
|
998
|
+
},
|
999
|
+
|
1000
|
+
showMode: function(dir) {
|
1001
|
+
|
1002
|
+
if (dir) {
|
1003
|
+
var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir));
|
1004
|
+
if (newViewMode >= this.minView && newViewMode <= this.maxView) {
|
1005
|
+
this.viewMode = newViewMode;
|
1006
|
+
}
|
1007
|
+
}
|
1008
|
+
/*
|
1009
|
+
vitalets: fixing bug of very special conditions:
|
1010
|
+
jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
|
1011
|
+
Method show() does not set display css correctly and datepicker is not shown.
|
1012
|
+
Changed to .css('display', 'block') solve the problem.
|
1013
|
+
See https://github.com/vitalets/x-editable/issues/37
|
1014
|
+
|
1015
|
+
In jquery 1.7.2+ everything works fine.
|
1016
|
+
*/
|
1017
|
+
//this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
|
1018
|
+
this.picker.find('>div').hide().filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
|
1019
|
+
this.updateNavArrows();
|
1020
|
+
},
|
1021
|
+
reset: function(e) {
|
1022
|
+
this._setDate(null, 'date');
|
1023
|
+
}
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
$.fn.fdatepicker = function(option) {
|
1027
|
+
var args = Array.apply(null, arguments);
|
1028
|
+
args.shift();
|
1029
|
+
return this.each(function() {
|
1030
|
+
var $this = $(this),
|
1031
|
+
data = $this.data('datepicker'),
|
1032
|
+
options = typeof option == 'object' && option;
|
1033
|
+
if (!data) {
|
1034
|
+
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.fdatepicker.defaults, options))));
|
1035
|
+
}
|
1036
|
+
if (typeof option == 'string' && typeof data[option] == 'function') {
|
1037
|
+
data[option].apply(data, args);
|
1038
|
+
}
|
1039
|
+
});
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
$.fn.fdatepicker.defaults = {
|
1043
|
+
onRender: function(date) {
|
1044
|
+
return '';
|
1045
|
+
}
|
1046
|
+
};
|
1047
|
+
$.fn.fdatepicker.Constructor = Datepicker;
|
1048
|
+
var dates = $.fn.fdatepicker.dates = {
|
1049
|
+
'en': {
|
1050
|
+
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
|
1051
|
+
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
1052
|
+
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
|
1053
|
+
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
1054
|
+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
1055
|
+
today: "Today",
|
1056
|
+
titleFormat: "MM yyyy"
|
1057
|
+
}
|
1058
|
+
};
|
1059
|
+
|
1060
|
+
var DPGlobal = {
|
1061
|
+
modes: [{
|
1062
|
+
clsName: 'minutes',
|
1063
|
+
navFnc: 'Hours',
|
1064
|
+
navStep: 1
|
1065
|
+
}, {
|
1066
|
+
clsName: 'hours',
|
1067
|
+
navFnc: 'Date',
|
1068
|
+
navStep: 1
|
1069
|
+
}, {
|
1070
|
+
clsName: 'days',
|
1071
|
+
navFnc: 'Month',
|
1072
|
+
navStep: 1
|
1073
|
+
}, {
|
1074
|
+
clsName: 'months',
|
1075
|
+
navFnc: 'FullYear',
|
1076
|
+
navStep: 1
|
1077
|
+
}, {
|
1078
|
+
clsName: 'years',
|
1079
|
+
navFnc: 'FullYear',
|
1080
|
+
navStep: 10
|
1081
|
+
}],
|
1082
|
+
isLeapYear: function(year) {
|
1083
|
+
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
|
1084
|
+
},
|
1085
|
+
getDaysInMonth: function(year, month) {
|
1086
|
+
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
1087
|
+
},
|
1088
|
+
validParts: /hh?|ii?|ss?|dd?|mm?|MM?|yy(?:yy)?/g,
|
1089
|
+
nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
|
1090
|
+
parseFormat: function(format) {
|
1091
|
+
// IE treats \0 as a string end in inputs (truncating the value),
|
1092
|
+
// so it's a bad format delimiter, anyway
|
1093
|
+
var separators = format.replace(this.validParts, '\0').split('\0'),
|
1094
|
+
parts = format.match(this.validParts);
|
1095
|
+
if (!separators || !separators.length || !parts || parts.length === 0) {
|
1096
|
+
throw new Error("Invalid date format.");
|
1097
|
+
}
|
1098
|
+
return {
|
1099
|
+
separators: separators,
|
1100
|
+
parts: parts
|
1101
|
+
};
|
1102
|
+
},
|
1103
|
+
parseDate: function(date, format, language) {
|
1104
|
+
if (date instanceof Date) return new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
|
1105
|
+
if (/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)) {
|
1106
|
+
format = this.parseFormat('yyyy-mm-dd');
|
1107
|
+
}
|
1108
|
+
if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(date)) {
|
1109
|
+
format = this.parseFormat('yyyy-mm-dd hh:ii');
|
1110
|
+
}
|
1111
|
+
if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(date)) {
|
1112
|
+
format = this.parseFormat('yyyy-mm-dd hh:ii:ss');
|
1113
|
+
}
|
1114
|
+
if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) {
|
1115
|
+
var part_re = /([-+]\d+)([dmwy])/,
|
1116
|
+
parts = date.match(/([-+]\d+)([dmwy])/g),
|
1117
|
+
part, dir;
|
1118
|
+
date = new Date();
|
1119
|
+
for (var i = 0; i < parts.length; i++) {
|
1120
|
+
part = part_re.exec(parts[i]);
|
1121
|
+
dir = parseInt(part[1]);
|
1122
|
+
switch (part[2]) {
|
1123
|
+
case 'd':
|
1124
|
+
date.setUTCDate(date.getUTCDate() + dir);
|
1125
|
+
break;
|
1126
|
+
case 'm':
|
1127
|
+
date = Datetimepicker.prototype.moveMonth.call(Datetimepicker.prototype, date, dir);
|
1128
|
+
break;
|
1129
|
+
case 'w':
|
1130
|
+
date.setUTCDate(date.getUTCDate() + dir * 7);
|
1131
|
+
break;
|
1132
|
+
case 'y':
|
1133
|
+
date = Datetimepicker.prototype.moveYear.call(Datetimepicker.prototype, date, dir);
|
1134
|
+
break;
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
1138
|
+
}
|
1139
|
+
var parts = date && date.match(this.nonpunctuation) || [],
|
1140
|
+
date = new Date(),
|
1141
|
+
parsed = {},
|
1142
|
+
setters_order = ['hh', 'h', 'ii', 'i', 'ss', 's', 'yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
|
1143
|
+
setters_map = {
|
1144
|
+
hh: function(d, v) {
|
1145
|
+
return d.setUTCHours(v);
|
1146
|
+
},
|
1147
|
+
h: function(d, v) {
|
1148
|
+
return d.setUTCHours(v);
|
1149
|
+
},
|
1150
|
+
ii: function(d, v) {
|
1151
|
+
return d.setUTCMinutes(v);
|
1152
|
+
},
|
1153
|
+
i: function(d, v) {
|
1154
|
+
return d.setUTCMinutes(v);
|
1155
|
+
},
|
1156
|
+
ss: function(d, v) {
|
1157
|
+
return d.setUTCSeconds(v);
|
1158
|
+
},
|
1159
|
+
s: function(d, v) {
|
1160
|
+
return d.setUTCSeconds(v);
|
1161
|
+
},
|
1162
|
+
yyyy: function(d, v) {
|
1163
|
+
return d.setUTCFullYear(v);
|
1164
|
+
},
|
1165
|
+
yy: function(d, v) {
|
1166
|
+
return d.setUTCFullYear(2000 + v);
|
1167
|
+
},
|
1168
|
+
m: function(d, v) {
|
1169
|
+
v -= 1;
|
1170
|
+
while (v < 0) v += 12;
|
1171
|
+
v %= 12;
|
1172
|
+
d.setUTCMonth(v);
|
1173
|
+
while (d.getUTCMonth() != v)
|
1174
|
+
d.setUTCDate(d.getUTCDate() - 1);
|
1175
|
+
return d;
|
1176
|
+
},
|
1177
|
+
d: function(d, v) {
|
1178
|
+
return d.setUTCDate(v);
|
1179
|
+
}
|
1180
|
+
},
|
1181
|
+
val, filtered, part;
|
1182
|
+
setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
|
1183
|
+
setters_map['dd'] = setters_map['d'];
|
1184
|
+
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); //date.getHours(), date.getMinutes(), date.getSeconds());
|
1185
|
+
if (parts.length == format.parts.length) {
|
1186
|
+
for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
|
1187
|
+
val = parseInt(parts[i], 10);
|
1188
|
+
part = format.parts[i];
|
1189
|
+
if (isNaN(val)) {
|
1190
|
+
switch (part) {
|
1191
|
+
case 'MM':
|
1192
|
+
filtered = $(dates[language].months).filter(function() {
|
1193
|
+
var m = this.slice(0, parts[i].length),
|
1194
|
+
p = parts[i].slice(0, m.length);
|
1195
|
+
return m == p;
|
1196
|
+
});
|
1197
|
+
val = $.inArray(filtered[0], dates[language].months) + 1;
|
1198
|
+
break;
|
1199
|
+
case 'M':
|
1200
|
+
filtered = $(dates[language].monthsShort).filter(function() {
|
1201
|
+
var m = this.slice(0, parts[i].length),
|
1202
|
+
p = parts[i].slice(0, m.length);
|
1203
|
+
return m == p;
|
1204
|
+
});
|
1205
|
+
val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
|
1206
|
+
break;
|
1207
|
+
}
|
1208
|
+
}
|
1209
|
+
parsed[part] = val;
|
1210
|
+
}
|
1211
|
+
for (var i = 0, s; i < setters_order.length; i++) {
|
1212
|
+
s = setters_order[i];
|
1213
|
+
if (s in parsed && !isNaN(parsed[s]))
|
1214
|
+
setters_map[s](date, parsed[s])
|
1215
|
+
}
|
1216
|
+
}
|
1217
|
+
return date;
|
1218
|
+
},
|
1219
|
+
formatDate: function(date, format, language) {
|
1220
|
+
if (date == null) {
|
1221
|
+
return '';
|
1222
|
+
}
|
1223
|
+
var val = {
|
1224
|
+
h: date.getUTCHours(),
|
1225
|
+
i: date.getUTCMinutes(),
|
1226
|
+
s: date.getUTCSeconds(),
|
1227
|
+
d: date.getUTCDate(),
|
1228
|
+
m: date.getUTCMonth() + 1,
|
1229
|
+
M: dates[language].monthsShort[date.getUTCMonth()],
|
1230
|
+
MM: dates[language].months[date.getUTCMonth()],
|
1231
|
+
yy: date.getUTCFullYear().toString().substring(2),
|
1232
|
+
yyyy: date.getUTCFullYear()
|
1233
|
+
};
|
1234
|
+
val.hh = (val.h < 10 ? '0' : '') + val.h;
|
1235
|
+
val.ii = (val.i < 10 ? '0' : '') + val.i;
|
1236
|
+
val.ss = (val.s < 10 ? '0' : '') + val.s;
|
1237
|
+
val.dd = (val.d < 10 ? '0' : '') + val.d;
|
1238
|
+
val.mm = (val.m < 10 ? '0' : '') + val.m;
|
1239
|
+
var date = [],
|
1240
|
+
seps = $.extend([], format.separators);
|
1241
|
+
for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
|
1242
|
+
if (seps.length)
|
1243
|
+
date.push(seps.shift())
|
1244
|
+
date.push(val[format.parts[i]]);
|
1245
|
+
}
|
1246
|
+
return date.join('');
|
1247
|
+
},
|
1248
|
+
convertViewMode: function(viewMode) {
|
1249
|
+
switch (viewMode) {
|
1250
|
+
case 4:
|
1251
|
+
case 'decade':
|
1252
|
+
viewMode = 4;
|
1253
|
+
break;
|
1254
|
+
case 3:
|
1255
|
+
case 'year':
|
1256
|
+
viewMode = 3;
|
1257
|
+
break;
|
1258
|
+
case 2:
|
1259
|
+
case 'month':
|
1260
|
+
viewMode = 2;
|
1261
|
+
break;
|
1262
|
+
case 1:
|
1263
|
+
case 'day':
|
1264
|
+
viewMode = 1;
|
1265
|
+
break;
|
1266
|
+
case 0:
|
1267
|
+
case 'hour':
|
1268
|
+
viewMode = 0;
|
1269
|
+
break;
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
return viewMode;
|
1273
|
+
},
|
1274
|
+
headTemplate: '<thead>' +
|
1275
|
+
'<tr>' +
|
1276
|
+
'<th class="prev"><i class="fa fa-chevron-left fi-arrow-left"/></th>' +
|
1277
|
+
'<th colspan="5" class="date-switch"></th>' +
|
1278
|
+
'<th class="next"><i class="fa fa-chevron-right fi-arrow-right"/></th>' +
|
1279
|
+
'</tr>' +
|
1280
|
+
'</thead>',
|
1281
|
+
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
1282
|
+
footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'
|
1283
|
+
};
|
1284
|
+
DPGlobal.template = '<div class="datepicker">' +
|
1285
|
+
'<div class="datepicker-minutes">' +
|
1286
|
+
'<table class=" table-condensed">' +
|
1287
|
+
DPGlobal.headTemplate +
|
1288
|
+
DPGlobal.contTemplate +
|
1289
|
+
DPGlobal.footTemplate +
|
1290
|
+
'</table>' +
|
1291
|
+
'</div>' +
|
1292
|
+
'<div class="datepicker-hours">' +
|
1293
|
+
'<table class=" table-condensed">' +
|
1294
|
+
DPGlobal.headTemplate +
|
1295
|
+
DPGlobal.contTemplate +
|
1296
|
+
DPGlobal.footTemplate +
|
1297
|
+
'</table>' +
|
1298
|
+
'</div>' +
|
1299
|
+
'<div class="datepicker-days">' +
|
1300
|
+
'<table class=" table-condensed">' +
|
1301
|
+
DPGlobal.headTemplate +
|
1302
|
+
'<tbody></tbody>' +
|
1303
|
+
DPGlobal.footTemplate +
|
1304
|
+
'</table>' +
|
1305
|
+
'</div>' +
|
1306
|
+
'<div class="datepicker-months">' +
|
1307
|
+
'<table class="table-condensed">' +
|
1308
|
+
DPGlobal.headTemplate +
|
1309
|
+
DPGlobal.contTemplate +
|
1310
|
+
DPGlobal.footTemplate +
|
1311
|
+
'</table>' +
|
1312
|
+
'</div>' +
|
1313
|
+
'<div class="datepicker-years">' +
|
1314
|
+
'<table class="table-condensed">' +
|
1315
|
+
DPGlobal.headTemplate +
|
1316
|
+
DPGlobal.contTemplate +
|
1317
|
+
DPGlobal.footTemplate +
|
1318
|
+
'</table>' +
|
1319
|
+
'</div>' +
|
1320
|
+
'<a class="button datepicker-close tiny alert right" style="width:auto;"><i class="fa fa-remove fa-times fi-x"></i></a>' +
|
1321
|
+
'</div>';
|
1322
|
+
|
1323
|
+
$.fn.fdatepicker.DPGlobal = DPGlobal;
|
1324
|
+
|
1325
|
+
}(window.jQuery);
|