jquery-dateandtimepicker-rails 1.0.0 → 1.0.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: ed539537d9b38cae99731e9da25a8d3181e97186
4
- data.tar.gz: af6dfc00dbb8d35f4961e4944752f8bf2af3fc51
3
+ metadata.gz: 68f2444a5fe7a010b1bfbb540371fd7f65f26ae1
4
+ data.tar.gz: 46af3783f04f6cd2bab802f7bfedfe371daa4bed
5
5
  SHA512:
6
- metadata.gz: f2544beefe7b880984cf31b13cbd4bbe3d7d39292ca5169897bf62cc6871c4d5ffade022198b55f47f98ee453ee06bbb9b26715224e20b446fac969ec2cabf65
7
- data.tar.gz: c43a086568505a2c1274b4f1aaf0c424fc2eacbb812bdffef72c4eea321113bdf17dc1feb051e44e870843dcbf06d1bda3cf35dcd36c0a15861e60e59a3a6c95
6
+ metadata.gz: 8885545c5b747f976ae54bf7a85b40cd0edde5fca5d9363dc9e315efd3d0359e0dd466ab153523fefb38ad9b88ecf80c53b6cba58f431367d4ef43fbdeda7f3b
7
+ data.tar.gz: 6e7950120e9c0c4c6282cc53294aaf775224d2dce7a2d029b20a065659bab1f308d630c483e013b781bfc7cafd8cf8b72336b9a6b8ec5e3b7f2b036990984707
data/README.md CHANGED
@@ -1,36 +1,44 @@
1
- # Jquery::Dateandtimepicker::Rails
1
+ jQuery Date and Time picker for rails
2
+ =====================================
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jquery/dateandtimepicker/rails`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+ [jQuery Date and Time picker plugin](https://github.com/xdan/datetimepicker) by @xdan for Ruby on Rails asset pipeline.
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ [![Gem Version](https://badge.fury.io/rb/jquery-dateandtimepicker-rails.svg)](http://badge.fury.io/rb/jquery-dateandtimepicker-rails)
6
7
 
7
- ## Installation
8
+ jQuery Date and Time picker plugin version: `v2.5.3`
8
9
 
9
10
  Add this line to your application's Gemfile:
10
11
 
11
- ```ruby
12
- gem 'jquery-dateandtimepicker-rails'
13
- ```
12
+ gem 'jquery-dateandtimepicker-rails', '~> 1.0.1'
14
13
 
15
14
  And then execute:
16
15
 
17
16
  $ bundle
18
17
 
19
- Or install it yourself as:
18
+ Add this line to `app/assets/stylesheets/application.css`:
20
19
 
21
- $ gem install jquery-dateandtimepicker-rails
20
+ *= require jquery.datetimepicker
22
21
 
23
- ## Usage
22
+ Add this line to `app/assets/javascripts/application.js`:
24
23
 
25
- TODO: Write usage instructions here
24
+ //= require jquery.datetimepicker
26
25
 
27
- ## Development
26
+ You can autoinitialize datetime picker on page load for elements with class `datetimepicker` by also adding to js manifest:
28
27
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ //= require jquery.datetimepicker/init
30
29
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+ Usage
31
+ -----
32
32
 
33
- ## Contributing
33
+ $('.datetimepicker').datetimepicker();
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jquery-dateandtimepicker-rails.
35
+ See the official [documentation](http://xdsoft.net/jqplugins/datetimepicker/) for examples and options.
36
36
 
37
+ Contributing
38
+ ------------
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
@@ -1,10 +1,21 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.4.5
2
+ * @preserve jQuery DateTimePicker plugin v2.5.3
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
- * (c) 2014, Chupurnov Valeriy.
4
+ * @author Chupurnov Valeriy (<chupurnov@gmail.com>)
5
5
  */
6
- /*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
7
- (function ($) {
6
+ /*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
7
+ ;(function (factory) {
8
+ if ( typeof define === 'function' && define.amd ) {
9
+ // AMD. Register as an anonymous module.
10
+ define(['jquery', 'jquery-mousewheel'], factory);
11
+ } else if (typeof exports === 'object') {
12
+ // Node/CommonJS style for Browserify
13
+ module.exports = factory;
14
+ } else {
15
+ // Browser globals
16
+ factory(jQuery);
17
+ }
18
+ }(function ($) {
8
19
  'use strict';
9
20
  var default_options = {
10
21
  i18n: {
@@ -12,151 +23,169 @@
12
23
  months: [
13
24
  "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
14
25
  ],
15
- dayOfWeek: [
26
+ dayOfWeekShort: [
16
27
  "ن", "ث", "ع", "خ", "ج", "س", "ح"
17
- ]
28
+ ],
29
+ dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
18
30
  },
19
31
  ro: { // Romanian
20
32
  months: [
21
- "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"
33
+ "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
22
34
  ],
23
- dayOfWeek: [
24
- "l", "ma", "mi", "j", "v", "s", "d"
25
- ]
35
+ dayOfWeekShort: [
36
+ "Du", "Lu", "Ma", "Mi", "Jo", "Vi", ""
37
+ ],
38
+ dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
26
39
  },
27
40
  id: { // Indonesian
28
41
  months: [
29
42
  "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
30
43
  ],
31
- dayOfWeek: [
44
+ dayOfWeekShort: [
32
45
  "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
33
- ]
46
+ ],
47
+ dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
34
48
  },
35
49
  is: { // Icelandic
36
50
  months: [
37
51
  "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
38
52
  ],
39
- dayOfWeek: [
53
+ dayOfWeekShort: [
40
54
  "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
41
- ]
55
+ ],
56
+ dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
42
57
  },
43
58
  bg: { // Bulgarian
44
59
  months: [
45
60
  "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
46
61
  ],
47
- dayOfWeek: [
62
+ dayOfWeekShort: [
48
63
  "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
49
- ]
64
+ ],
65
+ dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
50
66
  },
51
67
  fa: { // Persian/Farsi
52
68
  months: [
53
69
  'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
54
70
  ],
55
- dayOfWeek: [
71
+ dayOfWeekShort: [
56
72
  'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
57
- ]
73
+ ],
74
+ dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"]
58
75
  },
59
76
  ru: { // Russian
60
77
  months: [
61
78
  'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
62
79
  ],
63
- dayOfWeek: [
64
- "Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
65
- ]
80
+ dayOfWeekShort: [
81
+ "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
82
+ ],
83
+ dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
66
84
  },
67
85
  uk: { // Ukrainian
68
86
  months: [
69
87
  'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
70
88
  ],
71
- dayOfWeek: [
89
+ dayOfWeekShort: [
72
90
  "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
73
- ]
91
+ ],
92
+ dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
74
93
  },
75
94
  en: { // English
76
95
  months: [
77
96
  "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
78
97
  ],
79
- dayOfWeek: [
98
+ dayOfWeekShort: [
80
99
  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
81
- ]
100
+ ],
101
+ dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
82
102
  },
83
103
  el: { // Ελληνικά
84
104
  months: [
85
105
  "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
86
106
  ],
87
- dayOfWeek: [
107
+ dayOfWeekShort: [
88
108
  "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
89
- ]
109
+ ],
110
+ dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
90
111
  },
91
112
  de: { // German
92
113
  months: [
93
114
  'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
94
115
  ],
95
- dayOfWeek: [
116
+ dayOfWeekShort: [
96
117
  "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
97
- ]
118
+ ],
119
+ dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
98
120
  },
99
121
  nl: { // Dutch
100
122
  months: [
101
123
  "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
102
124
  ],
103
- dayOfWeek: [
125
+ dayOfWeekShort: [
104
126
  "zo", "ma", "di", "wo", "do", "vr", "za"
105
- ]
127
+ ],
128
+ dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
106
129
  },
107
130
  tr: { // Turkish
108
131
  months: [
109
132
  "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
110
133
  ],
111
- dayOfWeek: [
134
+ dayOfWeekShort: [
112
135
  "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
113
- ]
136
+ ],
137
+ dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
114
138
  },
115
139
  fr: { //French
116
140
  months: [
117
141
  "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
118
142
  ],
119
- dayOfWeek: [
143
+ dayOfWeekShort: [
120
144
  "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
121
- ]
145
+ ],
146
+ dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
122
147
  },
123
148
  es: { // Spanish
124
149
  months: [
125
150
  "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
126
151
  ],
127
- dayOfWeek: [
152
+ dayOfWeekShort: [
128
153
  "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
129
- ]
154
+ ],
155
+ dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
130
156
  },
131
157
  th: { // Thai
132
158
  months: [
133
159
  'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
134
160
  ],
135
- dayOfWeek: [
161
+ dayOfWeekShort: [
136
162
  'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
137
- ]
163
+ ],
164
+ dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
138
165
  },
139
166
  pl: { // Polish
140
167
  months: [
141
168
  "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
142
169
  ],
143
- dayOfWeek: [
170
+ dayOfWeekShort: [
144
171
  "nd", "pn", "wt", "śr", "cz", "pt", "sb"
145
- ]
172
+ ],
173
+ dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
146
174
  },
147
175
  pt: { // Portuguese
148
176
  months: [
149
177
  "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
150
178
  ],
151
- dayOfWeek: [
179
+ dayOfWeekShort: [
152
180
  "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
153
- ]
181
+ ],
182
+ dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
154
183
  },
155
184
  ch: { // Simplified Chinese
156
185
  months: [
157
186
  "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
158
187
  ],
159
- dayOfWeek: [
188
+ dayOfWeekShort: [
160
189
  "日", "一", "二", "三", "四", "五", "六"
161
190
  ]
162
191
  },
@@ -164,7 +193,7 @@
164
193
  months: [
165
194
  "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
166
195
  ],
167
- dayOfWeek: [
196
+ dayOfWeekShort: [
168
197
  "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
169
198
  ]
170
199
  },
@@ -172,63 +201,70 @@
172
201
  months: [
173
202
  "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
174
203
  ],
175
- dayOfWeek: [
204
+ dayOfWeekShort: [
176
205
  "일", "월", "화", "수", "목", "금", "토"
177
- ]
206
+ ],
207
+ dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
178
208
  },
179
209
  it: { // Italian
180
210
  months: [
181
211
  "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
182
212
  ],
183
- dayOfWeek: [
213
+ dayOfWeekShort: [
184
214
  "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
185
- ]
215
+ ],
216
+ dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
186
217
  },
187
218
  da: { // Dansk
188
219
  months: [
189
220
  "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
190
221
  ],
191
- dayOfWeek: [
222
+ dayOfWeekShort: [
192
223
  "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
193
- ]
224
+ ],
225
+ dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
194
226
  },
195
227
  no: { // Norwegian
196
228
  months: [
197
229
  "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
198
230
  ],
199
- dayOfWeek: [
231
+ dayOfWeekShort: [
200
232
  "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
201
- ]
233
+ ],
234
+ dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
202
235
  },
203
236
  ja: { // Japanese
204
237
  months: [
205
238
  "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
206
239
  ],
207
- dayOfWeek: [
240
+ dayOfWeekShort: [
208
241
  "日", "月", "火", "水", "木", "金", "土"
209
- ]
242
+ ],
243
+ dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
210
244
  },
211
245
  vi: { // Vietnamese
212
246
  months: [
213
247
  "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
214
248
  ],
215
- dayOfWeek: [
249
+ dayOfWeekShort: [
216
250
  "CN", "T2", "T3", "T4", "T5", "T6", "T7"
217
- ]
251
+ ],
252
+ dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
218
253
  },
219
254
  sl: { // Slovenščina
220
255
  months: [
221
256
  "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
222
257
  ],
223
- dayOfWeek: [
258
+ dayOfWeekShort: [
224
259
  "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
225
- ]
260
+ ],
261
+ dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
226
262
  },
227
263
  cs: { // Čeština
228
264
  months: [
229
265
  "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
230
266
  ],
231
- dayOfWeek: [
267
+ dayOfWeekShort: [
232
268
  "Ne", "Po", "Út", "St", "Čt", "Pá", "So"
233
269
  ]
234
270
  },
@@ -236,213 +272,260 @@
236
272
  months: [
237
273
  "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
238
274
  ],
239
- dayOfWeek: [
275
+ dayOfWeekShort: [
240
276
  "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
241
- ]
277
+ ],
278
+ dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
242
279
  },
243
280
  az: { //Azerbaijanian (Azeri)
244
281
  months: [
245
282
  "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
246
283
  ],
247
- dayOfWeek: [
284
+ dayOfWeekShort: [
248
285
  "B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
249
- ]
286
+ ],
287
+ dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
250
288
  },
251
289
  bs: { //Bosanski
252
290
  months: [
253
291
  "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
254
292
  ],
255
- dayOfWeek: [
293
+ dayOfWeekShort: [
256
294
  "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
257
- ]
295
+ ],
296
+ dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
258
297
  },
259
298
  ca: { //Català
260
299
  months: [
261
300
  "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
262
301
  ],
263
- dayOfWeek: [
302
+ dayOfWeekShort: [
264
303
  "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
265
- ]
304
+ ],
305
+ dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
266
306
  },
267
307
  'en-GB': { //English (British)
268
308
  months: [
269
309
  "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
270
310
  ],
271
- dayOfWeek: [
311
+ dayOfWeekShort: [
272
312
  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
273
- ]
313
+ ],
314
+ dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
274
315
  },
275
316
  et: { //"Eesti"
276
317
  months: [
277
318
  "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
278
319
  ],
279
- dayOfWeek: [
320
+ dayOfWeekShort: [
280
321
  "P", "E", "T", "K", "N", "R", "L"
281
- ]
322
+ ],
323
+ dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
282
324
  },
283
325
  eu: { //Euskara
284
326
  months: [
285
327
  "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
286
328
  ],
287
- dayOfWeek: [
329
+ dayOfWeekShort: [
288
330
  "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
289
- ]
331
+ ],
332
+ dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
290
333
  },
291
334
  fi: { //Finnish (Suomi)
292
335
  months: [
293
336
  "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
294
337
  ],
295
- dayOfWeek: [
338
+ dayOfWeekShort: [
296
339
  "Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
297
- ]
340
+ ],
341
+ dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
298
342
  },
299
343
  gl: { //Galego
300
344
  months: [
301
345
  "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
302
346
  ],
303
- dayOfWeek: [
347
+ dayOfWeekShort: [
304
348
  "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
305
- ]
349
+ ],
350
+ dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
306
351
  },
307
352
  hr: { //Hrvatski
308
353
  months: [
309
354
  "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
310
355
  ],
311
- dayOfWeek: [
356
+ dayOfWeekShort: [
312
357
  "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
313
- ]
358
+ ],
359
+ dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
314
360
  },
315
361
  ko: { //Korean (한국어)
316
362
  months: [
317
363
  "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
318
364
  ],
319
- dayOfWeek: [
365
+ dayOfWeekShort: [
320
366
  "일", "월", "화", "수", "목", "금", "토"
321
- ]
367
+ ],
368
+ dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
322
369
  },
323
370
  lt: { //Lithuanian (lietuvių)
324
371
  months: [
325
372
  "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
326
373
  ],
327
- dayOfWeek: [
374
+ dayOfWeekShort: [
328
375
  "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
329
- ]
376
+ ],
377
+ dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
330
378
  },
331
379
  lv: { //Latvian (Latviešu)
332
380
  months: [
333
381
  "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
334
382
  ],
335
- dayOfWeek: [
383
+ dayOfWeekShort: [
336
384
  "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
337
- ]
385
+ ],
386
+ dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
338
387
  },
339
388
  mk: { //Macedonian (Македонски)
340
389
  months: [
341
390
  "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
342
391
  ],
343
- dayOfWeek: [
392
+ dayOfWeekShort: [
344
393
  "нед", "пон", "вто", "сре", "чет", "пет", "саб"
345
- ]
394
+ ],
395
+ dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
346
396
  },
347
397
  mn: { //Mongolian (Монгол)
348
398
  months: [
349
399
  "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
350
400
  ],
351
- dayOfWeek: [
401
+ dayOfWeekShort: [
352
402
  "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
353
- ]
403
+ ],
404
+ dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
354
405
  },
355
406
  'pt-BR': { //Português(Brasil)
356
407
  months: [
357
408
  "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
358
409
  ],
359
- dayOfWeek: [
410
+ dayOfWeekShort: [
360
411
  "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
361
- ]
412
+ ],
413
+ dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
362
414
  },
363
415
  sk: { //Slovenčina
364
416
  months: [
365
417
  "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
366
418
  ],
367
- dayOfWeek: [
419
+ dayOfWeekShort: [
368
420
  "Ne", "Po", "Ut", "St", "Št", "Pi", "So"
369
- ]
421
+ ],
422
+ dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
370
423
  },
371
424
  sq: { //Albanian (Shqip)
372
425
  months: [
373
- "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
426
+ "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
374
427
  ],
375
- dayOfWeek: [
376
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
377
- ]
428
+ dayOfWeekShort: [
429
+ "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
430
+ ],
431
+ dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
378
432
  },
379
433
  'sr-YU': { //Serbian (Srpski)
380
434
  months: [
381
435
  "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
382
436
  ],
383
- dayOfWeek: [
437
+ dayOfWeekShort: [
384
438
  "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
385
- ]
439
+ ],
440
+ dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
386
441
  },
387
442
  sr: { //Serbian Cyrillic (Српски)
388
443
  months: [
389
444
  "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
390
445
  ],
391
- dayOfWeek: [
446
+ dayOfWeekShort: [
392
447
  "нед", "пон", "уто", "сре", "чет", "пет", "суб"
393
- ]
448
+ ],
449
+ dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
394
450
  },
395
451
  sv: { //Svenska
396
452
  months: [
397
453
  "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
398
454
  ],
399
- dayOfWeek: [
455
+ dayOfWeekShort: [
400
456
  "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
401
- ]
457
+ ],
458
+ dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
402
459
  },
403
460
  'zh-TW': { //Traditional Chinese (繁體中文)
404
461
  months: [
405
462
  "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
406
463
  ],
407
- dayOfWeek: [
464
+ dayOfWeekShort: [
408
465
  "日", "一", "二", "三", "四", "五", "六"
409
- ]
466
+ ],
467
+ dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
410
468
  },
411
469
  zh: { //Simplified Chinese (简体中文)
412
470
  months: [
413
471
  "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
414
472
  ],
415
- dayOfWeek: [
473
+ dayOfWeekShort: [
416
474
  "日", "一", "二", "三", "四", "五", "六"
417
- ]
475
+ ],
476
+ dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
418
477
  },
419
478
  he: { //Hebrew (עברית)
420
479
  months: [
421
480
  'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
422
481
  ],
423
- dayOfWeek: [
482
+ dayOfWeekShort: [
424
483
  'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
425
- ]
484
+ ],
485
+ dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
426
486
  },
427
487
  hy: { // Armenian
428
488
  months: [
429
489
  "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
430
490
  ],
431
- dayOfWeek: [
491
+ dayOfWeekShort: [
432
492
  "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
493
+ ],
494
+ dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
495
+ },
496
+ kg: { // Kyrgyz
497
+ months: [
498
+ 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
499
+ ],
500
+ dayOfWeekShort: [
501
+ "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
502
+ ],
503
+ dayOfWeek: [
504
+ "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
433
505
  ]
434
506
  },
435
- kg: { // Kyrgyz
436
- months: [
437
- 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
438
- ],
439
- dayOfWeek: [
440
- "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
441
- ]
442
- }
507
+ rm: { // Romansh
508
+ months: [
509
+ "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
510
+ ],
511
+ dayOfWeekShort: [
512
+ "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
513
+ ],
514
+ dayOfWeek: [
515
+ "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
516
+ ]
517
+ },
518
+ ka: { // Georgian
519
+ months: [
520
+ 'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი'
521
+ ],
522
+ dayOfWeekShort: [
523
+ "კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
524
+ ],
525
+ dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
526
+ },
443
527
  },
444
528
  value: '',
445
- lang: 'en',
446
529
  rtl: false,
447
530
 
448
531
  format: 'Y/m/d H:i',
@@ -481,6 +564,7 @@
481
564
  onSelectDate: function () {},
482
565
  onSelectTime: function () {},
483
566
  onChangeMonth: function () {},
567
+ onGetWeekOfYear: function () {},
484
568
  onChangeYear: function () {},
485
569
  onChangeDateTime: function () {},
486
570
  onShow: function () {},
@@ -521,14 +605,66 @@
521
605
  weekends: [],
522
606
  highlightedDates: [],
523
607
  highlightedPeriods: [],
608
+ allowDates : [],
609
+ allowDateRe : null,
524
610
  disabledDates : [],
525
611
  disabledWeekDays: [],
526
612
  yearOffset: 0,
527
613
  beforeShowDay: null,
528
614
 
529
615
  enterLikeTab: true,
530
- showApplyButton: false
616
+ showApplyButton: false
617
+ };
618
+
619
+ var dateHelper = null,
620
+ globalLocaleDefault = 'en',
621
+ globalLocale = 'en';
622
+
623
+ var dateFormatterOptionsDefault = {
624
+ meridiem: ['AM', 'PM']
531
625
  };
626
+
627
+ var initDateFormatter = function(){
628
+ var locale = default_options.i18n[globalLocale],
629
+ opts = {
630
+ days: locale.dayOfWeek,
631
+ daysShort: locale.dayOfWeekShort,
632
+ months: locale.months,
633
+ monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }),
634
+ };
635
+
636
+ dateHelper = new DateFormatter({
637
+ dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
638
+ });
639
+ };
640
+
641
+ // for locale settings
642
+ $.datetimepicker = {
643
+ setLocale: function(locale){
644
+ var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault;
645
+ if(globalLocale != newLocale){
646
+ globalLocale = newLocale;
647
+ // reinit date formatter
648
+ initDateFormatter();
649
+ }
650
+ },
651
+ setDateFormatter: function(dateFormatter) {
652
+ dateHelper = dateFormatter;
653
+ },
654
+ RFC_2822: 'D, d M Y H:i:s O',
655
+ ATOM: 'Y-m-d\TH:i:sP',
656
+ ISO_8601: 'Y-m-d\TH:i:sO',
657
+ RFC_822: 'D, d M y H:i:s O',
658
+ RFC_850: 'l, d-M-y H:i:s T',
659
+ RFC_1036: 'D, d M y H:i:s O',
660
+ RFC_1123: 'D, d M Y H:i:s O',
661
+ RSS: 'D, d M Y H:i:s O',
662
+ W3C: 'Y-m-d\TH:i:sP'
663
+ };
664
+
665
+ // first init date formatter
666
+ initDateFormatter();
667
+
532
668
  // fix for ie8
533
669
  if (!window.getComputedStyle) {
534
670
  window.getComputedStyle = function (el, pseudo) {
@@ -576,7 +712,6 @@
576
712
  }
577
713
  return out;
578
714
  },
579
- move = 0,
580
715
  timebox,
581
716
  parentHeight,
582
717
  height,
@@ -624,12 +759,12 @@
624
759
  startTopScroll = parseInt(scroller.css('margin-top'), 10);
625
760
  h1 = scrollbar[0].offsetHeight;
626
761
 
627
- if (event.type === 'mousedown') {
762
+ if (event.type === 'mousedown' || event.type === 'touchstart') {
628
763
  if (document) {
629
764
  $(document.body).addClass('xdsoft_noselect');
630
765
  }
631
- $([document.body, window]).on('mouseup.xdsoft_scroller', function arguments_callee() {
632
- $([document.body, window]).off('mouseup.xdsoft_scroller', arguments_callee)
766
+ $([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
767
+ $([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
633
768
  .off('mousemove.xdsoft_scroller', calcOffset)
634
769
  .removeClass('xdsoft_noselect');
635
770
  });
@@ -646,7 +781,7 @@
646
781
  calcOffset(event);
647
782
  }
648
783
  })
649
- .on('touchend touchcancel', function (event) {
784
+ .on('touchend touchcancel', function () {
650
785
  touchStart = false;
651
786
  startTopScroll = 0;
652
787
  });
@@ -708,7 +843,7 @@
708
843
  }
709
844
  });
710
845
 
711
- timeboxparent.on('touchend touchcancel', function (event) {
846
+ timeboxparent.on('touchend touchcancel', function () {
712
847
  start = false;
713
848
  startTop = 0;
714
849
  });
@@ -717,8 +852,9 @@
717
852
  });
718
853
  };
719
854
 
720
- $.fn.datetimepicker = function (opt) {
721
- var KEY0 = 48,
855
+ $.fn.datetimepicker = function (opt, opt2) {
856
+ var result = this,
857
+ KEY0 = 48,
722
858
  KEY9 = 57,
723
859
  _KEY0 = 96,
724
860
  _KEY9 = 105,
@@ -747,7 +883,7 @@
747
883
 
748
884
  lazyInit = function (input) {
749
885
  input
750
- .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) {
886
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
751
887
  if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
752
888
  return;
753
889
  }
@@ -758,7 +894,7 @@
758
894
  createDateTimePicker(input);
759
895
  }
760
896
  input
761
- .off('open.xdsoft focusin.xdsoft mousedown.xdsoft', initOnActionCallback)
897
+ .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
762
898
  .trigger('open.xdsoft');
763
899
  }, 100);
764
900
  });
@@ -776,21 +912,20 @@
776
912
  timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
777
913
  timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
778
914
  timebox = $('<div class="xdsoft_time_variant"></div>'),
779
- applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
780
- /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
781
- scroller = $('<div class="xdsoft_scroller"></div>'),*/
915
+ applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
916
+
782
917
  monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
783
918
  yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
784
919
  triggerAfterOpen = false,
785
920
  XDSoft_datetime,
786
- //scroll_element,
921
+
787
922
  xchangeTimer,
788
923
  timerclick,
789
924
  current_time_index,
790
925
  setPos,
791
926
  timer = 0,
792
- timer1 = 0,
793
- _xdsoft_datetime;
927
+ _xdsoft_datetime,
928
+ forEachAncestorOf;
794
929
 
795
930
  if (options.id) {
796
931
  datetimepicker.attr('id', options.id);
@@ -817,7 +952,7 @@
817
952
 
818
953
  mounth_picker
819
954
  .find('.xdsoft_month,.xdsoft_year')
820
- .on('mousedown.xdsoft', function (event) {
955
+ .on('touchstart mousedown.xdsoft', function (event) {
821
956
  var select = $(this).find('.xdsoft_select').eq(0),
822
957
  val = 0,
823
958
  top = 0,
@@ -849,12 +984,11 @@
849
984
  mounth_picker
850
985
  .find('.xdsoft_select')
851
986
  .xdsoftScroller()
852
- .on('mousedown.xdsoft', function (event) {
987
+ .on('touchstart mousedown.xdsoft', function (event) {
853
988
  event.stopPropagation();
854
989
  event.preventDefault();
855
990
  })
856
- .on('mousedown.xdsoft', '.xdsoft_option', function (event) {
857
-
991
+ .on('touchstart mousedown.xdsoft', '.xdsoft_option', function () {
858
992
  if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
859
993
  _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
860
994
  }
@@ -876,49 +1010,13 @@
876
1010
  }
877
1011
  });
878
1012
 
1013
+ datetimepicker.getValue = function () {
1014
+ return _xdsoft_datetime.getCurrentTime();
1015
+ };
1016
+
879
1017
  datetimepicker.setOptions = function (_options) {
880
- var highlightedDates = {},
881
- getCaretPos = function (input) {
882
- try {
883
- if (document.selection && document.selection.createRange) {
884
- var range = document.selection.createRange();
885
- return range.getBookmark().charCodeAt(2) - 2;
886
- }
887
- if (input.setSelectionRange) {
888
- return input.selectionStart;
889
- }
890
- } catch (e) {
891
- return 0;
892
- }
893
- },
894
- setCaretPos = function (node, pos) {
895
- node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
896
- if (!node) {
897
- return false;
898
- }
899
- if (node.createTextRange) {
900
- var textRange = node.createTextRange();
901
- textRange.collapse(true);
902
- textRange.moveEnd('character', pos);
903
- textRange.moveStart('character', pos);
904
- textRange.select();
905
- return true;
906
- }
907
- if (node.setSelectionRange) {
908
- node.setSelectionRange(pos, pos);
909
- return true;
910
- }
911
- return false;
912
- },
913
- isValidValue = function (mask, value) {
914
- var reg = mask
915
- .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
916
- .replace(/_/g, '{digit+}')
917
- .replace(/([0-9]{1})/g, '{digit$1}')
918
- .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
919
- .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
920
- return (new RegExp(reg)).test(value);
921
- };
1018
+ var highlightedDates = {};
1019
+
922
1020
  options = $.extend(true, {}, options, _options);
923
1021
 
924
1022
  if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
@@ -929,12 +1027,20 @@
929
1027
  options.weekends = $.extend(true, [], _options.weekends);
930
1028
  }
931
1029
 
1030
+ if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
1031
+ options.allowDates = $.extend(true, [], _options.allowDates);
1032
+ }
1033
+
1034
+ if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
1035
+ options.allowDateRe = new RegExp(_options.allowDateRe);
1036
+ }
1037
+
932
1038
  if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
933
1039
  $.each(_options.highlightedDates, function (index, value) {
934
1040
  var splitData = $.map(value.split(','), $.trim),
935
1041
  exDesc,
936
- hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
937
- keyDate = hDate.date.dateFormat(options.formatDate);
1042
+ hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
1043
+ keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
938
1044
  if (highlightedDates[keyDate] !== undefined) {
939
1045
  exDesc = highlightedDates[keyDate].desc;
940
1046
  if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
@@ -951,18 +1057,30 @@
951
1057
  if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
952
1058
  highlightedDates = $.extend(true, [], options.highlightedDates);
953
1059
  $.each(_options.highlightedPeriods, function (index, value) {
954
- var splitData = $.map(value.split(','), $.trim),
955
- dateTest = Date.parseDate(splitData[0], options.formatDate), // start date
956
- dateEnd = Date.parseDate(splitData[1], options.formatDate),
957
- desc = splitData[2],
1060
+ var dateTest, // start date
1061
+ dateEnd,
1062
+ desc,
958
1063
  hDate,
959
1064
  keyDate,
960
1065
  exDesc,
1066
+ style;
1067
+ if ($.isArray(value)) {
1068
+ dateTest = value[0];
1069
+ dateEnd = value[1];
1070
+ desc = value[2];
1071
+ style = value[3];
1072
+ }
1073
+ else {
1074
+ var splitData = $.map(value.split(','), $.trim);
1075
+ dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
1076
+ dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
1077
+ desc = splitData[2];
961
1078
  style = splitData[3];
1079
+ }
962
1080
 
963
1081
  while (dateTest <= dateEnd) {
964
1082
  hDate = new HighlightedDate(dateTest, desc, style);
965
- keyDate = dateTest.dateFormat(options.formatDate);
1083
+ keyDate = dateHelper.formatDate(dateTest, options.formatDate);
966
1084
  dateTest.setDate(dateTest.getDate() + 1);
967
1085
  if (highlightedDates[keyDate] !== undefined) {
968
1086
  exDesc = highlightedDates[keyDate].desc;
@@ -983,7 +1101,7 @@
983
1101
  }
984
1102
 
985
1103
  if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
986
- options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
1104
+ options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
987
1105
  }
988
1106
 
989
1107
  if ((options.open || options.opened) && (!options.inline)) {
@@ -1031,11 +1149,11 @@
1031
1149
  }
1032
1150
 
1033
1151
  if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
1034
- options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate);
1152
+ options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
1035
1153
  }
1036
1154
 
1037
1155
  if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
1038
- options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate);
1156
+ options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
1039
1157
  }
1040
1158
 
1041
1159
  applyButton.toggle(options.showApplyButton);
@@ -1052,104 +1170,37 @@
1052
1170
  .find('.' + options.next)
1053
1171
  .css('visibility', !options.nextButton ? 'hidden' : 'visible');
1054
1172
 
1055
- if (options.mask) {
1056
- input.off('keydown.xdsoft');
1057
-
1058
- if (options.mask === true) {
1059
- options.mask = options.format
1060
- .replace(/Y/g, '9999')
1061
- .replace(/F/g, '9999')
1062
- .replace(/m/g, '19')
1063
- .replace(/d/g, '39')
1064
- .replace(/H/g, '29')
1065
- .replace(/i/g, '59')
1066
- .replace(/s/g, '59');
1067
- }
1068
-
1069
- if ($.type(options.mask) === 'string') {
1070
- if (!isValidValue(options.mask, input.val())) {
1071
- input.val(options.mask.replace(/[0-9]/g, '_'));
1072
- }
1073
-
1074
- input.on('keydown.xdsoft', function (event) {
1075
- var val = this.value,
1076
- key = event.which,
1077
- pos,
1078
- digit;
1079
-
1080
- if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
1081
- pos = getCaretPos(this);
1082
- digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
1083
-
1084
- if ((key === BACKSPACE || key === DEL) && pos) {
1085
- pos -= 1;
1086
- digit = '_';
1087
- }
1088
-
1089
- while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
1090
- pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
1091
- }
1092
-
1093
- val = val.substr(0, pos) + digit + val.substr(pos + 1);
1094
- if ($.trim(val) === '') {
1095
- val = options.mask.replace(/[0-9]/g, '_');
1096
- } else {
1097
- if (pos === options.mask.length) {
1098
- event.preventDefault();
1099
- return false;
1100
- }
1101
- }
1102
-
1103
- pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
1104
- while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
1105
- pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
1106
- }
1107
-
1108
- if (isValidValue(options.mask, val)) {
1109
- this.value = val;
1110
- setCaretPos(this, pos);
1111
- } else if ($.trim(val) === '') {
1112
- this.value = options.mask.replace(/[0-9]/g, '_');
1113
- } else {
1114
- input.trigger('error_input.xdsoft');
1115
- }
1116
- } else {
1117
- if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
1118
- return true;
1119
- }
1120
- }
1173
+ setMask(options);
1121
1174
 
1122
- event.preventDefault();
1123
- return false;
1124
- });
1125
- }
1126
- }
1127
1175
  if (options.validateOnBlur) {
1128
1176
  input
1129
1177
  .off('blur.xdsoft')
1130
1178
  .on('blur.xdsoft', function () {
1131
- if (options.allowBlank && !$.trim($(this).val()).length) {
1179
+ if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
1132
1180
  $(this).val(null);
1133
1181
  datetimepicker.data('xdsoft_datetime').empty();
1134
- } else if (!Date.parseDate($(this).val(), options.format)) {
1135
- var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
1136
- splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1137
-
1138
- // parse the numbers as 0312 => 03:12
1139
- if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1140
- $(this).val([splittedHours, splittedMinutes].map(function (item) {
1141
- return item > 9 ? item : '0' + item;
1142
- }).join(':'));
1182
+ } else {
1183
+ var d = dateHelper.parseDate($(this).val(), options.format);
1184
+ if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
1185
+ $(this).val(dateHelper.formatDate(d, options.format));
1143
1186
  } else {
1144
- $(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
1187
+ var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
1188
+ splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1189
+
1190
+ // parse the numbers as 0312 => 03:12
1191
+ if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1192
+ $(this).val([splittedHours, splittedMinutes].map(function (item) {
1193
+ return item > 9 ? item : '0' + item;
1194
+ }).join(':'));
1195
+ } else {
1196
+ $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
1197
+ }
1145
1198
  }
1146
-
1147
- datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1148
- } else {
1149
1199
  datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1150
1200
  }
1151
1201
 
1152
1202
  datetimepicker.trigger('changedatetime.xdsoft');
1203
+ datetimepicker.trigger('close.xdsoft');
1153
1204
  });
1154
1205
  }
1155
1206
  options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
@@ -1161,7 +1212,7 @@
1161
1212
 
1162
1213
  datetimepicker
1163
1214
  .data('options', options)
1164
- .on('mousedown.xdsoft', function (event) {
1215
+ .on('touchstart mousedown.xdsoft', function (event) {
1165
1216
  event.stopPropagation();
1166
1217
  event.preventDefault();
1167
1218
  yearselect.hide();
@@ -1301,7 +1352,16 @@
1301
1352
  };
1302
1353
 
1303
1354
  _this.getWeekOfYear = function (datetime) {
1355
+ if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
1356
+ var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
1357
+ if (typeof week !== 'undefined') {
1358
+ return week;
1359
+ }
1360
+ }
1304
1361
  var onejan = new Date(datetime.getFullYear(), 0, 1);
1362
+ //First week of the year is th one with the first Thursday according to ISO8601
1363
+ if(onejan.getDay()!=4)
1364
+ onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
1305
1365
  return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
1306
1366
  };
1307
1367
 
@@ -1314,13 +1374,13 @@
1314
1374
 
1315
1375
  tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
1316
1376
  if (tmpDate) {
1317
- tmpDate[2] = Date.parseDate(tmpDate[2], options.formatDate);
1377
+ tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
1318
1378
  }
1319
1379
  if (tmpDate && tmpDate[2]) {
1320
1380
  timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
1321
1381
  currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
1322
1382
  } else {
1323
- currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now();
1383
+ currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
1324
1384
  }
1325
1385
 
1326
1386
  if (!_this.isValidDate(currentTime)) {
@@ -1335,7 +1395,7 @@
1335
1395
  return sDate;
1336
1396
  }
1337
1397
 
1338
- var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true);
1398
+ var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
1339
1399
  if (!_this.isValidDate(currentTime)) {
1340
1400
  currentTime = _this.now(true);
1341
1401
  }
@@ -1346,7 +1406,7 @@
1346
1406
  if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
1347
1407
  return sTime;
1348
1408
  }
1349
- var currentTime = sTime ? Date.parseDate(sTime, options.formatTime) : _this.now(true);
1409
+ var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
1350
1410
  if (!_this.isValidDate(currentTime)) {
1351
1411
  currentTime = _this.now(true);
1352
1412
  }
@@ -1354,23 +1414,23 @@
1354
1414
  };
1355
1415
 
1356
1416
  _this.str = function () {
1357
- return _this.currentTime.dateFormat(options.format);
1417
+ return dateHelper.formatDate(_this.currentTime, options.format);
1358
1418
  };
1359
1419
  _this.currentTime = this.now();
1360
1420
  };
1361
1421
 
1362
1422
  _xdsoft_datetime = new XDSoft_datetime();
1363
1423
 
1364
- applyButton.on('click', function (e) {//pathbrite
1365
- e.preventDefault();
1366
- datetimepicker.data('changed', true);
1367
- _xdsoft_datetime.setCurrentTime(getCurrentValue());
1368
- input.val(_xdsoft_datetime.str());
1369
- datetimepicker.trigger('close.xdsoft');
1370
- });
1424
+ applyButton.on('touchend click', function (e) {//pathbrite
1425
+ e.preventDefault();
1426
+ datetimepicker.data('changed', true);
1427
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
1428
+ input.val(_xdsoft_datetime.str());
1429
+ datetimepicker.trigger('close.xdsoft');
1430
+ });
1371
1431
  mounth_picker
1372
1432
  .find('.xdsoft_today_button')
1373
- .on('mousedown.xdsoft', function () {
1433
+ .on('touchend mousedown.xdsoft', function () {
1374
1434
  datetimepicker.data('changed', true);
1375
1435
  _xdsoft_datetime.setCurrentTime(0);
1376
1436
  datetimepicker.trigger('afterOpen.xdsoft');
@@ -1388,11 +1448,12 @@
1388
1448
  return;
1389
1449
  }
1390
1450
  input.val(_xdsoft_datetime.str());
1451
+ input.trigger('change');
1391
1452
  datetimepicker.trigger('close.xdsoft');
1392
1453
  });
1393
1454
  mounth_picker
1394
1455
  .find('.xdsoft_prev,.xdsoft_next')
1395
- .on('mousedown.xdsoft', function () {
1456
+ .on('touchend mousedown.xdsoft', function () {
1396
1457
  var $this = $(this),
1397
1458
  timer = 0,
1398
1459
  stop = false;
@@ -1410,16 +1471,16 @@
1410
1471
  }
1411
1472
  }(500));
1412
1473
 
1413
- $([document.body, window]).on('mouseup.xdsoft', function arguments_callee2() {
1474
+ $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() {
1414
1475
  clearTimeout(timer);
1415
1476
  stop = true;
1416
- $([document.body, window]).off('mouseup.xdsoft', arguments_callee2);
1477
+ $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2);
1417
1478
  });
1418
1479
  });
1419
1480
 
1420
1481
  timepicker
1421
1482
  .find('.xdsoft_prev,.xdsoft_next')
1422
- .on('mousedown.xdsoft', function () {
1483
+ .on('touchend mousedown.xdsoft', function () {
1423
1484
  var $this = $(this),
1424
1485
  timer = 0,
1425
1486
  stop = false,
@@ -1433,17 +1494,30 @@
1433
1494
  } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
1434
1495
  timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
1435
1496
  }
1436
- timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
1497
+ /**
1498
+ * Fixed bug:
1499
+ * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
1500
+ * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
1501
+ * would cause a bug when you use jquery.css method.
1502
+ * Let's say: * { transition: all .5s ease; }
1503
+ * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
1504
+ * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
1505
+ * next/prev button.
1506
+ *
1507
+ * What we should do:
1508
+ * Replace timebox.css('marginTop') with timebox[0].style.marginTop.
1509
+ */
1510
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
1437
1511
  period = (period > 10) ? 10 : period - 10;
1438
1512
  if (!stop) {
1439
1513
  timer = setTimeout(arguments_callee4, v || period);
1440
1514
  }
1441
1515
  }(500));
1442
- $([document.body, window]).on('mouseup.xdsoft', function arguments_callee5() {
1516
+ $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() {
1443
1517
  clearTimeout(timer);
1444
1518
  stop = true;
1445
1519
  $([document.body, window])
1446
- .off('mouseup.xdsoft', arguments_callee5);
1520
+ .off('touchend mouseup.xdsoft', arguments_callee5);
1447
1521
  });
1448
1522
  });
1449
1523
 
@@ -1490,7 +1564,7 @@
1490
1564
  }
1491
1565
 
1492
1566
  for (j = 0; j < 7; j += 1) {
1493
- table += '<th>' + options.i18n[options.lang].dayOfWeek[(j + options.dayOfWeekStart) % 7] + '</th>';
1567
+ table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
1494
1568
  }
1495
1569
 
1496
1570
  table += '</tr></thead>';
@@ -1525,12 +1599,22 @@
1525
1599
  customDateSettings = null;
1526
1600
  }
1527
1601
 
1528
- if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
1602
+ if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
1603
+ if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
1604
+ classes.push('xdsoft_disabled');
1605
+ }
1606
+ } else if(options.allowDates && options.allowDates.length>0){
1607
+ if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
1608
+ classes.push('xdsoft_disabled');
1609
+ }
1610
+ } else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
1529
1611
  classes.push('xdsoft_disabled');
1530
- } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) {
1612
+ } else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
1531
1613
  classes.push('xdsoft_disabled');
1532
1614
  } else if (options.disabledWeekDays.indexOf(day) !== -1) {
1533
- classes.push('xdsoft_disabled');
1615
+ classes.push('xdsoft_disabled');
1616
+ }else if (input.is('[readonly]')) {
1617
+ classes.push('xdsoft_disabled');
1534
1618
  }
1535
1619
 
1536
1620
  if (customDateSettings && customDateSettings[1] !== "") {
@@ -1541,20 +1625,20 @@
1541
1625
  classes.push('xdsoft_other_month');
1542
1626
  }
1543
1627
 
1544
- if ((options.defaultSelect || datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
1628
+ if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
1545
1629
  classes.push('xdsoft_current');
1546
1630
  }
1547
1631
 
1548
- if (today.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
1632
+ if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
1549
1633
  classes.push('xdsoft_today');
1550
1634
  }
1551
1635
 
1552
- if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) {
1636
+ if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
1553
1637
  classes.push('xdsoft_weekend');
1554
1638
  }
1555
1639
 
1556
- if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) {
1557
- hDate = options.highlightedDates[start.dateFormat(options.formatDate)];
1640
+ if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
1641
+ hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
1558
1642
  classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
1559
1643
  description = hDate.desc === undefined ? '' : hDate.desc;
1560
1644
  }
@@ -1586,15 +1670,17 @@
1586
1670
 
1587
1671
  calendar.html(table);
1588
1672
 
1589
- mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
1673
+ mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
1590
1674
  mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
1591
1675
 
1592
1676
  // generate timebox
1593
1677
  time = '';
1594
1678
  h = '';
1595
1679
  m = '';
1680
+
1596
1681
  line_time = function line_time(h, m) {
1597
- var now = _xdsoft_datetime.now(), optionDateTime, current_time;
1682
+ var now = _xdsoft_datetime.now(), optionDateTime, current_time,
1683
+ isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
1598
1684
  now.setHours(h);
1599
1685
  h = parseInt(now.getHours(), 10);
1600
1686
  now.setMinutes(m);
@@ -1605,16 +1691,20 @@
1605
1691
  classes = [];
1606
1692
  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())) {
1607
1693
  classes.push('xdsoft_disabled');
1608
- }
1609
- if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
1694
+ } else if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
1695
+ classes.push('xdsoft_disabled');
1696
+ } else if (input.is('[readonly]')) {
1610
1697
  classes.push('xdsoft_disabled');
1611
1698
  }
1612
1699
 
1613
1700
  current_time = new Date(_xdsoft_datetime.currentTime);
1614
1701
  current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
1615
- current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
1616
1702
 
1617
- if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) {
1703
+ if (!isALlowTimesInit) {
1704
+ current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
1705
+ }
1706
+
1707
+ if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
1618
1708
  if (options.defaultSelect || datetimepicker.data('changed')) {
1619
1709
  classes.push('xdsoft_current');
1620
1710
  } else if (options.initTime) {
@@ -1624,7 +1714,7 @@
1624
1714
  if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
1625
1715
  classes.push('xdsoft_today');
1626
1716
  }
1627
- time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + now.dateFormat(options.formatTime) + '</div>';
1717
+ time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
1628
1718
  };
1629
1719
 
1630
1720
  if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
@@ -1655,7 +1745,7 @@
1655
1745
  .html(opt);
1656
1746
 
1657
1747
  for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
1658
- opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>';
1748
+ opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
1659
1749
  }
1660
1750
  monthselect.children().eq(0).html(opt);
1661
1751
  $(datetimepicker)
@@ -1687,7 +1777,7 @@
1687
1777
 
1688
1778
  timerclick = 0;
1689
1779
  calendar
1690
- .on('click.xdsoft', 'td', function (xdevent) {
1780
+ .on('touchend click.xdsoft', 'td', function (xdevent) {
1691
1781
  xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1692
1782
  timerclick += 1;
1693
1783
  var $this = $(this),
@@ -1710,9 +1800,6 @@
1710
1800
  datetimepicker.trigger('select.xdsoft', [currentTime]);
1711
1801
 
1712
1802
  input.val(_xdsoft_datetime.str());
1713
- if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
1714
- datetimepicker.trigger('close.xdsoft');
1715
- }
1716
1803
 
1717
1804
  if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
1718
1805
  options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
@@ -1721,13 +1808,16 @@
1721
1808
  datetimepicker.data('changed', true);
1722
1809
  datetimepicker.trigger('xchange.xdsoft');
1723
1810
  datetimepicker.trigger('changedatetime.xdsoft');
1811
+ if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
1812
+ datetimepicker.trigger('close.xdsoft');
1813
+ }
1724
1814
  setTimeout(function () {
1725
1815
  timerclick = 0;
1726
1816
  }, 200);
1727
1817
  });
1728
1818
 
1729
1819
  timebox
1730
- .on('click.xdsoft', 'div', function (xdevent) {
1820
+ .on('touchend click.xdsoft', 'div', function (xdevent) {
1731
1821
  xdevent.stopPropagation();
1732
1822
  var $this = $(this),
1733
1823
  currentTime = _xdsoft_datetime.currentTime;
@@ -1746,19 +1836,17 @@
1746
1836
 
1747
1837
  datetimepicker.data('input').val(_xdsoft_datetime.str());
1748
1838
 
1749
- if (options.inline !== true && options.closeOnTimeSelect === true) {
1750
- datetimepicker.trigger('close.xdsoft');
1751
- }
1752
-
1753
1839
  if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
1754
1840
  options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1755
1841
  }
1756
1842
  datetimepicker.data('changed', true);
1757
1843
  datetimepicker.trigger('xchange.xdsoft');
1758
1844
  datetimepicker.trigger('changedatetime.xdsoft');
1845
+ if (options.inline !== true && options.closeOnTimeSelect === true) {
1846
+ datetimepicker.trigger('close.xdsoft');
1847
+ }
1759
1848
  });
1760
1849
 
1761
-
1762
1850
  datepicker
1763
1851
  .on('mousewheel.xdsoft', function (event) {
1764
1852
  if (!options.scrollMonth) {
@@ -1821,40 +1909,131 @@
1821
1909
 
1822
1910
  current_time_index = 0;
1823
1911
 
1912
+ /**
1913
+ * Runs the callback for each of the specified node's ancestors.
1914
+ *
1915
+ * Return FALSE from the callback to stop ascending.
1916
+ *
1917
+ * @param {DOMNode} node
1918
+ * @param {Function} callback
1919
+ * @returns {undefined}
1920
+ */
1921
+ forEachAncestorOf = function (node, callback) {
1922
+ do {
1923
+ node = node.parentNode;
1924
+
1925
+ if (callback(node) === false) {
1926
+ break;
1927
+ }
1928
+ } while (node.nodeName !== 'HTML');
1929
+ };
1930
+
1931
+ /**
1932
+ * Sets the position of the picker.
1933
+ *
1934
+ * @returns {undefined}
1935
+ */
1824
1936
  setPos = function () {
1825
- var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute", node;
1826
- if (datetimepicker.data('input').parent().css('direction') == 'rtl')
1827
- left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth());
1937
+ var dateInputOffset,
1938
+ dateInputElem,
1939
+ verticalPosition,
1940
+ left,
1941
+ position,
1942
+ datetimepickerElem,
1943
+ dateInputHasFixedAncestor,
1944
+ $dateInput,
1945
+ windowWidth,
1946
+ verticalAnchorEdge,
1947
+ datetimepickerCss,
1948
+ windowHeight,
1949
+ windowScrollTop;
1950
+
1951
+ $dateInput = datetimepicker.data('input');
1952
+ dateInputOffset = $dateInput.offset();
1953
+ dateInputElem = $dateInput[0];
1954
+
1955
+ verticalAnchorEdge = 'top';
1956
+ verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
1957
+ left = dateInputOffset.left;
1958
+ position = "absolute";
1959
+
1960
+ windowWidth = $(window).width();
1961
+ windowHeight = $(window).height();
1962
+ windowScrollTop = $(window).scrollTop();
1963
+
1964
+ if ((document.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
1965
+ var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
1966
+ left = left - diff;
1967
+ }
1968
+
1969
+ if ($dateInput.parent().css('direction') === 'rtl') {
1970
+ left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
1971
+ }
1972
+
1828
1973
  if (options.fixed) {
1829
- top -= $(window).scrollTop();
1974
+ verticalPosition -= windowScrollTop;
1830
1975
  left -= $(window).scrollLeft();
1831
1976
  position = "fixed";
1832
1977
  } else {
1833
- if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) {
1834
- top = offset.top - datetimepicker[0].offsetHeight + 1;
1978
+ dateInputHasFixedAncestor = false;
1979
+
1980
+ forEachAncestorOf(dateInputElem, function (ancestorNode) {
1981
+ if (window.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
1982
+ dateInputHasFixedAncestor = true;
1983
+ return false;
1984
+ }
1985
+ });
1986
+
1987
+ if (dateInputHasFixedAncestor) {
1988
+ position = 'fixed';
1989
+
1990
+ //If the picker won't fit entirely within the viewport then display it above the date input.
1991
+ if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
1992
+ verticalAnchorEdge = 'bottom';
1993
+ verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
1994
+ } else {
1995
+ verticalPosition -= windowScrollTop;
1996
+ }
1997
+ } else {
1998
+ if (verticalPosition + dateInputElem.offsetHeight > windowHeight + windowScrollTop) {
1999
+ verticalPosition = dateInputOffset.top - dateInputElem.offsetHeight + 1;
2000
+ }
1835
2001
  }
1836
- if (top < 0) {
1837
- top = 0;
2002
+
2003
+ if (verticalPosition < 0) {
2004
+ verticalPosition = 0;
1838
2005
  }
1839
- if (left + datetimepicker[0].offsetWidth > $(window).width()) {
1840
- left = $(window).width() - datetimepicker[0].offsetWidth;
2006
+
2007
+ if (left + dateInputElem.offsetWidth > windowWidth) {
2008
+ left = windowWidth - dateInputElem.offsetWidth;
1841
2009
  }
1842
2010
  }
1843
2011
 
1844
- node = datetimepicker[0];
1845
- do {
1846
- node = node.parentNode;
1847
- if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
1848
- left = left - (($(window).width() - node.offsetWidth) / 2);
1849
- break;
2012
+ datetimepickerElem = datetimepicker[0];
2013
+
2014
+ forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
2015
+ var ancestorNodePosition;
2016
+
2017
+ ancestorNodePosition = window.getComputedStyle(ancestorNode).getPropertyValue('position');
2018
+
2019
+ if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
2020
+ left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
2021
+ return false;
1850
2022
  }
1851
- } while (node.nodeName !== 'HTML');
1852
- datetimepicker.css({
1853
- left: left,
1854
- top: top,
1855
- position: position
1856
2023
  });
2024
+
2025
+ datetimepickerCss = {
2026
+ position: position,
2027
+ left: left,
2028
+ top: '', //Initialize to prevent previous values interfering with new ones.
2029
+ bottom: '' //Initialize to prevent previous values interfering with new ones.
2030
+ };
2031
+
2032
+ datetimepickerCss[verticalAnchorEdge] = verticalPosition;
2033
+
2034
+ datetimepicker.css(datetimepickerCss);
1857
2035
  };
2036
+
1858
2037
  datetimepicker
1859
2038
  .on('open.xdsoft', function (event) {
1860
2039
  var onShow = true;
@@ -1869,9 +2048,9 @@
1869
2048
  .on('resize.xdsoft', setPos);
1870
2049
 
1871
2050
  if (options.closeOnWithoutClick) {
1872
- $([document.body, window]).on('mousedown.xdsoft', function arguments_callee6() {
2051
+ $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
1873
2052
  datetimepicker.trigger('close.xdsoft');
1874
- $([document.body, window]).off('mousedown.xdsoft', arguments_callee6);
2053
+ $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6);
1875
2054
  });
1876
2055
  }
1877
2056
  }
@@ -1890,7 +2069,7 @@
1890
2069
  }
1891
2070
  event.stopPropagation();
1892
2071
  })
1893
- .on('toggle.xdsoft', function (event) {
2072
+ .on('toggle.xdsoft', function () {
1894
2073
  if (datetimepicker.is(':visible')) {
1895
2074
  datetimepicker.trigger('close.xdsoft');
1896
2075
  } else {
@@ -1900,7 +2079,6 @@
1900
2079
  .data('input', input);
1901
2080
 
1902
2081
  timer = 0;
1903
- timer1 = 0;
1904
2082
 
1905
2083
  datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
1906
2084
  datetimepicker.setOptions(options);
@@ -1933,11 +2111,139 @@
1933
2111
  return ct || 0;
1934
2112
  }
1935
2113
 
2114
+ function setMask(options) {
2115
+
2116
+ var isValidValue = function (mask, value) {
2117
+ var reg = mask
2118
+ .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
2119
+ .replace(/_/g, '{digit+}')
2120
+ .replace(/([0-9]{1})/g, '{digit$1}')
2121
+ .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
2122
+ .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
2123
+ return (new RegExp(reg)).test(value);
2124
+ },
2125
+ getCaretPos = function (input) {
2126
+ try {
2127
+ if (document.selection && document.selection.createRange) {
2128
+ var range = document.selection.createRange();
2129
+ return range.getBookmark().charCodeAt(2) - 2;
2130
+ }
2131
+ if (input.setSelectionRange) {
2132
+ return input.selectionStart;
2133
+ }
2134
+ } catch (e) {
2135
+ return 0;
2136
+ }
2137
+ },
2138
+ setCaretPos = function (node, pos) {
2139
+ node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
2140
+ if (!node) {
2141
+ return false;
2142
+ }
2143
+ if (node.createTextRange) {
2144
+ var textRange = node.createTextRange();
2145
+ textRange.collapse(true);
2146
+ textRange.moveEnd('character', pos);
2147
+ textRange.moveStart('character', pos);
2148
+ textRange.select();
2149
+ return true;
2150
+ }
2151
+ if (node.setSelectionRange) {
2152
+ node.setSelectionRange(pos, pos);
2153
+ return true;
2154
+ }
2155
+ return false;
2156
+ };
2157
+ if(options.mask) {
2158
+ input.off('keydown.xdsoft');
2159
+ }
2160
+ if (options.mask === true) {
2161
+ if (typeof moment != 'undefined') {
2162
+ options.mask = options.format
2163
+ .replace(/Y{4}/g, '9999')
2164
+ .replace(/Y{2}/g, '99')
2165
+ .replace(/M{2}/g, '19')
2166
+ .replace(/D{2}/g, '39')
2167
+ .replace(/H{2}/g, '29')
2168
+ .replace(/m{2}/g, '59')
2169
+ .replace(/s{2}/g, '59');
2170
+ } else {
2171
+ options.mask = options.format
2172
+ .replace(/Y/g, '9999')
2173
+ .replace(/F/g, '9999')
2174
+ .replace(/m/g, '19')
2175
+ .replace(/d/g, '39')
2176
+ .replace(/H/g, '29')
2177
+ .replace(/i/g, '59')
2178
+ .replace(/s/g, '59');
2179
+ }
2180
+ }
2181
+
2182
+ if ($.type(options.mask) === 'string') {
2183
+ if (!isValidValue(options.mask, input.val())) {
2184
+ input.val(options.mask.replace(/[0-9]/g, '_'));
2185
+ setCaretPos(input[0], 0);
2186
+ }
2187
+
2188
+ input.on('keydown.xdsoft', function (event) {
2189
+ var val = this.value,
2190
+ key = event.which,
2191
+ pos,
2192
+ digit;
2193
+
2194
+ if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
2195
+ pos = getCaretPos(this);
2196
+ digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
2197
+
2198
+ if ((key === BACKSPACE || key === DEL) && pos) {
2199
+ pos -= 1;
2200
+ digit = '_';
2201
+ }
2202
+
2203
+ while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
2204
+ pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
2205
+ }
2206
+
2207
+ val = val.substr(0, pos) + digit + val.substr(pos + 1);
2208
+ if ($.trim(val) === '') {
2209
+ val = options.mask.replace(/[0-9]/g, '_');
2210
+ } else {
2211
+ if (pos === options.mask.length) {
2212
+ event.preventDefault();
2213
+ return false;
2214
+ }
2215
+ }
2216
+
2217
+ pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
2218
+ while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
2219
+ pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
2220
+ }
2221
+
2222
+ if (isValidValue(options.mask, val)) {
2223
+ this.value = val;
2224
+ setCaretPos(this, pos);
2225
+ } else if ($.trim(val) === '') {
2226
+ this.value = options.mask.replace(/[0-9]/g, '_');
2227
+ } else {
2228
+ input.trigger('error_input.xdsoft');
2229
+ }
2230
+ } else {
2231
+ if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
2232
+ return true;
2233
+ }
2234
+ }
2235
+
2236
+ event.preventDefault();
2237
+ return false;
2238
+ });
2239
+ }
2240
+ }
2241
+
1936
2242
  _xdsoft_datetime.setCurrentTime(getCurrentValue());
1937
2243
 
1938
2244
  input
1939
2245
  .data('xdsoft_datetimepicker', datetimepicker)
1940
- .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) {
2246
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
1941
2247
  if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
1942
2248
  return;
1943
2249
  }
@@ -1949,15 +2255,17 @@
1949
2255
 
1950
2256
  triggerAfterOpen = true;
1951
2257
  _xdsoft_datetime.setCurrentTime(getCurrentValue());
1952
-
2258
+ if(options.mask) {
2259
+ setMask(options);
2260
+ }
1953
2261
  datetimepicker.trigger('open.xdsoft');
1954
2262
  }, 100);
1955
2263
  })
1956
2264
  .on('keydown.xdsoft', function (event) {
1957
- var val = this.value, elementSelector,
2265
+ var elementSelector,
1958
2266
  key = event.which;
1959
2267
  if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
1960
- elementSelector = $("input:visible,textarea:visible");
2268
+ elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
1961
2269
  datetimepicker.trigger('close.xdsoft');
1962
2270
  elementSelector.eq(elementSelector.index(this) + 1).focus();
1963
2271
  return false;
@@ -1966,6 +2274,9 @@
1966
2274
  datetimepicker.trigger('close.xdsoft');
1967
2275
  return true;
1968
2276
  }
2277
+ })
2278
+ .on('blur.xdsoft', function () {
2279
+ datetimepicker.trigger('close.xdsoft');
1969
2280
  });
1970
2281
  };
1971
2282
  destroyDateTimePicker = function (input) {
@@ -1977,7 +2288,7 @@
1977
2288
  .data('xdsoft_datetimepicker', null)
1978
2289
  .off('.xdsoft');
1979
2290
  $(window).off('resize.xdsoft');
1980
- $([window, document.body]).off('mousedown.xdsoft');
2291
+ $([window, document.body]).off('mousedown.xdsoft touchstart');
1981
2292
  if (input.unmousewheel) {
1982
2293
  input.unmousewheel();
1983
2294
  }
@@ -1995,7 +2306,8 @@
1995
2306
  ctrlDown = false;
1996
2307
  }
1997
2308
  });
1998
- return this.each(function () {
2309
+
2310
+ this.each(function () {
1999
2311
  var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
2000
2312
  if (datetimepicker) {
2001
2313
  if ($.type(opt) === 'string') {
@@ -2015,7 +2327,7 @@
2015
2327
  break;
2016
2328
  case 'reset':
2017
2329
  this.value = this.defaultValue;
2018
- if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) {
2330
+ if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
2019
2331
  datetimepicker.data('changed', false);
2020
2332
  }
2021
2333
  datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
@@ -2024,6 +2336,10 @@
2024
2336
  $input = datetimepicker.data('input');
2025
2337
  $input.trigger('blur.xdsoft');
2026
2338
  break;
2339
+ default:
2340
+ if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
2341
+ result = datetimepicker[opt](opt2);
2342
+ }
2027
2343
  }
2028
2344
  } else {
2029
2345
  datetimepicker
@@ -2039,41 +2355,16 @@
2039
2355
  }
2040
2356
  }
2041
2357
  });
2358
+
2359
+ return result;
2042
2360
  };
2361
+
2043
2362
  $.fn.datetimepicker.defaults = default_options;
2044
- }(jQuery));
2045
-
2046
- function HighlightedDate(date, desc, style) {
2047
- "use strict";
2048
- this.date = date;
2049
- this.desc = desc;
2050
- this.style = style;
2051
- }
2052
-
2053
- (function () {
2054
-
2055
- /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
2056
- * Licensed under the MIT License (LICENSE.txt).
2057
- *
2058
- * Version: 3.1.12
2059
- *
2060
- * Requires: jQuery 1.2.2+
2061
- */
2062
- !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
2063
-
2064
- // Parse and Format Library
2065
- //http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
2066
- /*
2067
- * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
2068
- *
2069
- * This program is free software; you can redistribute it and/or modify it
2070
- * under the terms of the GNU Lesser General Public License as published by the
2071
- * Free Software Foundation, version 2.1.
2072
- *
2073
- * This program is distributed in the hope that it will be useful, but WITHOUT
2074
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2075
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
2076
- * details.
2077
- */
2078
- 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+"$",'i');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"};
2079
- }());
2363
+
2364
+ function HighlightedDate(date, desc, style) {
2365
+ "use strict";
2366
+ this.date = date;
2367
+ this.desc = desc;
2368
+ this.style = style;
2369
+ }
2370
+ }));