Нет описания

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026
  1. /**
  2. * @preserve jQuery DateTimePicker plugin v2.4.3
  3. * @homepage http://xdsoft.net/jqplugins/datetimepicker/
  4. * (c) 2014, Chupurnov Valeriy.
  5. */
  6. /*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
  7. (function ($) {
  8. 'use strict';
  9. var default_options = {
  10. i18n: {
  11. ar: { // Arabic
  12. months: [
  13. "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
  14. ],
  15. dayOfWeek: [
  16. "ن", "ث", "ع", "خ", "ج", "س", "ح"
  17. ]
  18. },
  19. ro: { // Romanian
  20. months: [
  21. "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"
  22. ],
  23. dayOfWeek: [
  24. "l", "ma", "mi", "j", "v", "s", "d"
  25. ]
  26. },
  27. id: { // Indonesian
  28. months: [
  29. "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
  30. ],
  31. dayOfWeek: [
  32. "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
  33. ]
  34. },
  35. bg: { // Bulgarian
  36. months: [
  37. "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
  38. ],
  39. dayOfWeek: [
  40. "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
  41. ]
  42. },
  43. fa: { // Persian/Farsi
  44. months: [
  45. 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
  46. ],
  47. dayOfWeek: [
  48. 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
  49. ]
  50. },
  51. ru: { // Russian
  52. months: [
  53. 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
  54. ],
  55. dayOfWeek: [
  56. "Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
  57. ]
  58. },
  59. uk: { // Ukrainian
  60. months: [
  61. 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
  62. ],
  63. dayOfWeek: [
  64. "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
  65. ]
  66. },
  67. en: { // English
  68. months: [
  69. "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  70. ],
  71. dayOfWeek: [
  72. "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  73. ]
  74. },
  75. el: { // Ελληνικά
  76. months: [
  77. "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
  78. ],
  79. dayOfWeek: [
  80. "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
  81. ]
  82. },
  83. de: { // German
  84. months: [
  85. 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
  86. ],
  87. dayOfWeek: [
  88. "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
  89. ]
  90. },
  91. nl: { // Dutch
  92. months: [
  93. "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
  94. ],
  95. dayOfWeek: [
  96. "zo", "ma", "di", "wo", "do", "vr", "za"
  97. ]
  98. },
  99. tr: { // Turkish
  100. months: [
  101. "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
  102. ],
  103. dayOfWeek: [
  104. "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
  105. ]
  106. },
  107. fr: { //French
  108. months: [
  109. "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
  110. ],
  111. dayOfWeek: [
  112. "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
  113. ]
  114. },
  115. es: { // Spanish
  116. months: [
  117. "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
  118. ],
  119. dayOfWeek: [
  120. "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
  121. ]
  122. },
  123. th: { // Thai
  124. months: [
  125. 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
  126. ],
  127. dayOfWeek: [
  128. 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
  129. ]
  130. },
  131. pl: { // Polish
  132. months: [
  133. "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
  134. ],
  135. dayOfWeek: [
  136. "nd", "pn", "wt", "śr", "cz", "pt", "sb"
  137. ]
  138. },
  139. pt: { // Portuguese
  140. months: [
  141. "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
  142. ],
  143. dayOfWeek: [
  144. "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
  145. ]
  146. },
  147. ch: { // Simplified Chinese
  148. months: [
  149. "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
  150. ],
  151. dayOfWeek: [
  152. "日", "一", "二", "三", "四", "五", "六"
  153. ]
  154. },
  155. se: { // Swedish
  156. months: [
  157. "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
  158. ],
  159. dayOfWeek: [
  160. "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
  161. ]
  162. },
  163. kr: { // Korean
  164. months: [
  165. "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
  166. ],
  167. dayOfWeek: [
  168. "일", "월", "화", "수", "목", "금", "토"
  169. ]
  170. },
  171. it: { // Italian
  172. months: [
  173. "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
  174. ],
  175. dayOfWeek: [
  176. "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
  177. ]
  178. },
  179. da: { // Dansk
  180. months: [
  181. "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
  182. ],
  183. dayOfWeek: [
  184. "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
  185. ]
  186. },
  187. no: { // Norwegian
  188. months: [
  189. "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
  190. ],
  191. dayOfWeek: [
  192. "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
  193. ]
  194. },
  195. ja: { // Japanese
  196. months: [
  197. "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
  198. ],
  199. dayOfWeek: [
  200. "日", "月", "火", "水", "木", "金", "土"
  201. ]
  202. },
  203. vi: { // Vietnamese
  204. months: [
  205. "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"
  206. ],
  207. dayOfWeek: [
  208. "CN", "T2", "T3", "T4", "T5", "T6", "T7"
  209. ]
  210. },
  211. sl: { // Slovenščina
  212. months: [
  213. "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
  214. ],
  215. dayOfWeek: [
  216. "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
  217. ]
  218. },
  219. cs: { // Čeština
  220. months: [
  221. "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
  222. ],
  223. dayOfWeek: [
  224. "Ne", "Po", "Út", "St", "Čt", "Pá", "So"
  225. ]
  226. },
  227. hu: { // Hungarian
  228. months: [
  229. "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
  230. ],
  231. dayOfWeek: [
  232. "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
  233. ]
  234. },
  235. az: { //Azerbaijanian (Azeri)
  236. months: [
  237. "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
  238. ],
  239. dayOfWeek: [
  240. "B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
  241. ]
  242. },
  243. bs: { //Bosanski
  244. months: [
  245. "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
  246. ],
  247. dayOfWeek: [
  248. "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
  249. ]
  250. },
  251. ca: { //Català
  252. months: [
  253. "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
  254. ],
  255. dayOfWeek: [
  256. "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
  257. ]
  258. },
  259. 'en-GB': { //English (British)
  260. months: [
  261. "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  262. ],
  263. dayOfWeek: [
  264. "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  265. ]
  266. },
  267. et: { //"Eesti"
  268. months: [
  269. "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
  270. ],
  271. dayOfWeek: [
  272. "P", "E", "T", "K", "N", "R", "L"
  273. ]
  274. },
  275. eu: { //Euskara
  276. months: [
  277. "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
  278. ],
  279. dayOfWeek: [
  280. "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
  281. ]
  282. },
  283. fi: { //Finnish (Suomi)
  284. months: [
  285. "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
  286. ],
  287. dayOfWeek: [
  288. "Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
  289. ]
  290. },
  291. gl: { //Galego
  292. months: [
  293. "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
  294. ],
  295. dayOfWeek: [
  296. "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
  297. ]
  298. },
  299. hr: { //Hrvatski
  300. months: [
  301. "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
  302. ],
  303. dayOfWeek: [
  304. "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
  305. ]
  306. },
  307. ko: { //Korean (한국어)
  308. months: [
  309. "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
  310. ],
  311. dayOfWeek: [
  312. "일", "월", "화", "수", "목", "금", "토"
  313. ]
  314. },
  315. lt: { //Lithuanian (lietuvių)
  316. months: [
  317. "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
  318. ],
  319. dayOfWeek: [
  320. "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
  321. ]
  322. },
  323. lv: { //Latvian (Latviešu)
  324. months: [
  325. "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
  326. ],
  327. dayOfWeek: [
  328. "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
  329. ]
  330. },
  331. mk: { //Macedonian (Македонски)
  332. months: [
  333. "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
  334. ],
  335. dayOfWeek: [
  336. "нед", "пон", "вто", "сре", "чет", "пет", "саб"
  337. ]
  338. },
  339. mn: { //Mongolian (Монгол)
  340. months: [
  341. "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
  342. ],
  343. dayOfWeek: [
  344. "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
  345. ]
  346. },
  347. 'pt-BR': { //Português(Brasil)
  348. months: [
  349. "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
  350. ],
  351. dayOfWeek: [
  352. "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
  353. ]
  354. },
  355. sk: { //Slovenčina
  356. months: [
  357. "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
  358. ],
  359. dayOfWeek: [
  360. "Ne", "Po", "Ut", "St", "Št", "Pi", "So"
  361. ]
  362. },
  363. sq: { //Albanian (Shqip)
  364. months: [
  365. "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  366. ],
  367. dayOfWeek: [
  368. "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  369. ]
  370. },
  371. 'sr-YU': { //Serbian (Srpski)
  372. months: [
  373. "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
  374. ],
  375. dayOfWeek: [
  376. "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
  377. ]
  378. },
  379. sr: { //Serbian Cyrillic (Српски)
  380. months: [
  381. "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
  382. ],
  383. dayOfWeek: [
  384. "нед", "пон", "уто", "сре", "чет", "пет", "суб"
  385. ]
  386. },
  387. sv: { //Svenska
  388. months: [
  389. "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
  390. ],
  391. dayOfWeek: [
  392. "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
  393. ]
  394. },
  395. 'zh-TW': { //Traditional Chinese (繁體中文)
  396. months: [
  397. "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
  398. ],
  399. dayOfWeek: [
  400. "日", "一", "二", "三", "四", "五", "六"
  401. ]
  402. },
  403. zh: { //Simplified Chinese (简体中文)
  404. months: [
  405. "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
  406. ],
  407. dayOfWeek: [
  408. "日", "一", "二", "三", "四", "五", "六"
  409. ]
  410. },
  411. he: { //Hebrew (עברית)
  412. months: [
  413. 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
  414. ],
  415. dayOfWeek: [
  416. 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
  417. ]
  418. },
  419. hy: { // Armenian
  420. months: [
  421. "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
  422. ],
  423. dayOfWeek: [
  424. "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
  425. ]
  426. },
  427. kg: { // Kyrgyz
  428. months: [
  429. 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
  430. ],
  431. dayOfWeek: [
  432. "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
  433. ]
  434. }
  435. },
  436. value: '',
  437. lang: 'en',
  438. format: 'Y/m/d H:i',
  439. formatTime: 'H:i',
  440. formatDate: 'Y/m/d',
  441. startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
  442. step: 60,
  443. monthChangeSpinner: true,
  444. closeOnDateSelect: false,
  445. closeOnTimeSelect: true,
  446. closeOnWithoutClick: true,
  447. closeOnInputClick: true,
  448. timepicker: true,
  449. datepicker: true,
  450. weeks: false,
  451. defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
  452. defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
  453. minDate: false,
  454. maxDate: false,
  455. minTime: false,
  456. maxTime: false,
  457. allowTimes: [],
  458. opened: false,
  459. initTime: true,
  460. inline: false,
  461. theme: '',
  462. onSelectDate: function () {},
  463. onSelectTime: function () {},
  464. onChangeMonth: function () {},
  465. onChangeYear: function () {},
  466. onChangeDateTime: function () {},
  467. onShow: function () {},
  468. onClose: function () {},
  469. onGenerate: function () {},
  470. withoutCopyright: true,
  471. inverseButton: false,
  472. hours12: false,
  473. next: 'xdsoft_next',
  474. prev : 'xdsoft_prev',
  475. dayOfWeekStart: 0,
  476. parentID: 'body',
  477. timeHeightInTimePicker: 25,
  478. timepickerScrollbar: true,
  479. todayButton: true,
  480. prevButton: true,
  481. nextButton: true,
  482. defaultSelect: true,
  483. scrollMonth: true,
  484. scrollTime: true,
  485. scrollInput: true,
  486. lazyInit: false,
  487. mask: false,
  488. validateOnBlur: true,
  489. allowBlank: true,
  490. yearStart: 1950,
  491. yearEnd: 2050,
  492. monthStart: 0,
  493. monthEnd: 11,
  494. style: '',
  495. id: '',
  496. fixed: false,
  497. roundTime: 'round', // ceil, floor
  498. className: '',
  499. weekends: [],
  500. highlightedDates: [],
  501. highlightedPeriods: [],
  502. disabledDates : [],
  503. yearOffset: 0,
  504. beforeShowDay: null,
  505. enterLikeTab: true,
  506. showApplyButton: false
  507. };
  508. // fix for ie8
  509. if (!Array.prototype.indexOf) {
  510. Array.prototype.indexOf = function (obj, start) {
  511. var i, j;
  512. for (i = (start || 0), j = this.length; i < j; i += 1) {
  513. if (this[i] === obj) { return i; }
  514. }
  515. return -1;
  516. };
  517. }
  518. Date.prototype.countDaysInMonth = function () {
  519. return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
  520. };
  521. $.fn.xdsoftScroller = function (percent) {
  522. return this.each(function () {
  523. var timeboxparent = $(this),
  524. pointerEventToXY = function (e) {
  525. var out = {x: 0, y: 0},
  526. touch;
  527. if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
  528. touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
  529. out.x = touch.clientX;
  530. out.y = touch.clientY;
  531. } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
  532. out.x = e.clientX;
  533. out.y = e.clientY;
  534. }
  535. return out;
  536. },
  537. move = 0,
  538. timebox,
  539. parentHeight,
  540. height,
  541. scrollbar,
  542. scroller,
  543. maximumOffset = 100,
  544. start = false,
  545. startY = 0,
  546. startTop = 0,
  547. h1 = 0,
  548. touchStart = false,
  549. startTopScroll = 0,
  550. calcOffset = function () {};
  551. if (percent === 'hide') {
  552. timeboxparent.find('.xdsoft_scrollbar').hide();
  553. return;
  554. }
  555. if (!$(this).hasClass('xdsoft_scroller_box')) {
  556. timebox = timeboxparent.children().eq(0);
  557. parentHeight = timeboxparent[0].clientHeight;
  558. height = timebox[0].offsetHeight;
  559. scrollbar = $('<div class="xdsoft_scrollbar"></div>');
  560. scroller = $('<div class="xdsoft_scroller"></div>');
  561. scrollbar.append(scroller);
  562. timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
  563. calcOffset = function calcOffset(event) {
  564. var offset = pointerEventToXY(event).y - startY + startTopScroll;
  565. if (offset < 0) {
  566. offset = 0;
  567. }
  568. if (offset + scroller[0].offsetHeight > h1) {
  569. offset = h1 - scroller[0].offsetHeight;
  570. }
  571. timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
  572. };
  573. scroller
  574. .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
  575. if (!parentHeight) {
  576. timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
  577. }
  578. startY = pointerEventToXY(event).y;
  579. startTopScroll = parseInt(scroller.css('margin-top'), 10);
  580. h1 = scrollbar[0].offsetHeight;
  581. if (event.type === 'mousedown') {
  582. if (document) {
  583. $(document.body).addClass('xdsoft_noselect');
  584. }
  585. $([document.body, window]).on('mouseup.xdsoft_scroller', function arguments_callee() {
  586. $([document.body, window]).off('mouseup.xdsoft_scroller', arguments_callee)
  587. .off('mousemove.xdsoft_scroller', calcOffset)
  588. .removeClass('xdsoft_noselect');
  589. });
  590. $(document.body).on('mousemove.xdsoft_scroller', calcOffset);
  591. } else {
  592. touchStart = true;
  593. event.stopPropagation();
  594. event.preventDefault();
  595. }
  596. })
  597. .on('touchmove', function (event) {
  598. if (touchStart) {
  599. event.preventDefault();
  600. calcOffset(event);
  601. }
  602. })
  603. .on('touchend touchcancel', function (event) {
  604. touchStart = false;
  605. startTopScroll = 0;
  606. });
  607. timeboxparent
  608. .on('scroll_element.xdsoft_scroller', function (event, percentage) {
  609. if (!parentHeight) {
  610. timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
  611. }
  612. percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
  613. scroller.css('margin-top', maximumOffset * percentage);
  614. setTimeout(function () {
  615. timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
  616. }, 10);
  617. })
  618. .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
  619. var percent, sh;
  620. parentHeight = timeboxparent[0].clientHeight;
  621. height = timebox[0].offsetHeight;
  622. percent = parentHeight / height;
  623. sh = percent * scrollbar[0].offsetHeight;
  624. if (percent > 1) {
  625. scroller.hide();
  626. } else {
  627. scroller.show();
  628. scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
  629. maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
  630. if (noTriggerScroll !== true) {
  631. timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
  632. }
  633. }
  634. });
  635. timeboxparent.on('mousewheel', function (event) {
  636. var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
  637. top = top - (event.deltaY * 20);
  638. if (top < 0) {
  639. top = 0;
  640. }
  641. timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
  642. event.stopPropagation();
  643. return false;
  644. });
  645. timeboxparent.on('touchstart', function (event) {
  646. start = pointerEventToXY(event);
  647. startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
  648. });
  649. timeboxparent.on('touchmove', function (event) {
  650. if (start) {
  651. event.preventDefault();
  652. var coord = pointerEventToXY(event);
  653. timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
  654. }
  655. });
  656. timeboxparent.on('touchend touchcancel', function (event) {
  657. start = false;
  658. startTop = 0;
  659. });
  660. }
  661. timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
  662. });
  663. };
  664. $.fn.datetimepicker = function (opt) {
  665. var KEY0 = 48,
  666. KEY9 = 57,
  667. _KEY0 = 96,
  668. _KEY9 = 105,
  669. CTRLKEY = 17,
  670. DEL = 46,
  671. ENTER = 13,
  672. ESC = 27,
  673. BACKSPACE = 8,
  674. ARROWLEFT = 37,
  675. ARROWUP = 38,
  676. ARROWRIGHT = 39,
  677. ARROWDOWN = 40,
  678. TAB = 9,
  679. F5 = 116,
  680. AKEY = 65,
  681. CKEY = 67,
  682. VKEY = 86,
  683. ZKEY = 90,
  684. YKEY = 89,
  685. ctrlDown = false,
  686. options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
  687. lazyInitTimer = 0,
  688. createDateTimePicker,
  689. destroyDateTimePicker,
  690. lazyInit = function (input) {
  691. input
  692. .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) {
  693. if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
  694. return;
  695. }
  696. clearTimeout(lazyInitTimer);
  697. lazyInitTimer = setTimeout(function () {
  698. if (!input.data('xdsoft_datetimepicker')) {
  699. createDateTimePicker(input);
  700. }
  701. input
  702. .off('open.xdsoft focusin.xdsoft mousedown.xdsoft', initOnActionCallback)
  703. .trigger('open.xdsoft');
  704. }, 100);
  705. });
  706. };
  707. createDateTimePicker = function (input) {
  708. var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
  709. xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
  710. datepicker = $('<div class="xdsoft_datepicker active"></div>'),
  711. mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
  712. '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
  713. '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
  714. '<button type="button" class="xdsoft_next"></button></div>'),
  715. calendar = $('<div class="xdsoft_calendar"></div>'),
  716. 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>'),
  717. timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
  718. timebox = $('<div class="xdsoft_time_variant"></div>'),
  719. applyButton = $('<button class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
  720. /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
  721. scroller = $('<div class="xdsoft_scroller"></div>'),*/
  722. monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
  723. yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
  724. triggerAfterOpen = false,
  725. XDSoft_datetime,
  726. //scroll_element,
  727. xchangeTimer,
  728. timerclick,
  729. current_time_index,
  730. setPos,
  731. timer = 0,
  732. timer1 = 0,
  733. _xdsoft_datetime;
  734. if (options.id) datetimepicker.attr('id', options.id);
  735. if (options.style) datetimepicker.attr('style', options.style);
  736. if (options.weeks) datetimepicker.addClass('xdsoft_showweeks');
  737. datetimepicker.addClass('xdsoft_' + options.theme);
  738. datetimepicker.addClass(options.className);
  739. mounth_picker
  740. .find('.xdsoft_month span')
  741. .after(monthselect);
  742. mounth_picker
  743. .find('.xdsoft_year span')
  744. .after(yearselect);
  745. mounth_picker
  746. .find('.xdsoft_month,.xdsoft_year')
  747. .on('mousedown.xdsoft', function (event) {
  748. var select = $(this).find('.xdsoft_select').eq(0),
  749. val = 0,
  750. top = 0,
  751. visible = select.is(':visible'),
  752. items,
  753. i;
  754. mounth_picker
  755. .find('.xdsoft_select')
  756. .hide();
  757. if (_xdsoft_datetime.currentTime) {
  758. val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
  759. }
  760. select[visible ? 'hide' : 'show']();
  761. for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
  762. if (items.eq(i).data('value') === val) {
  763. break;
  764. } else {
  765. top += items[0].offsetHeight;
  766. }
  767. }
  768. select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
  769. event.stopPropagation();
  770. return false;
  771. });
  772. mounth_picker
  773. .find('.xdsoft_select')
  774. .xdsoftScroller()
  775. .on('mousedown.xdsoft', function (event) {
  776. event.stopPropagation();
  777. event.preventDefault();
  778. })
  779. .on('mousedown.xdsoft', '.xdsoft_option', function (event) {
  780. if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
  781. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  782. }
  783. var year = _xdsoft_datetime.currentTime.getFullYear();
  784. if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
  785. _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
  786. }
  787. $(this).parent().parent().hide();
  788. datetimepicker.trigger('xchange.xdsoft');
  789. if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
  790. options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  791. }
  792. if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
  793. options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  794. }
  795. });
  796. datetimepicker.setOptions = function (_options) {
  797. var highlightedDates = {},
  798. getCaretPos = function (input) {
  799. try {
  800. if (document.selection && document.selection.createRange) {
  801. var range = document.selection.createRange();
  802. return range.getBookmark().charCodeAt(2) - 2;
  803. }
  804. if (input.setSelectionRange) {
  805. return input.selectionStart;
  806. }
  807. } catch (e) {
  808. return 0;
  809. }
  810. },
  811. setCaretPos = function (node, pos) {
  812. node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
  813. if (!node) {
  814. return false;
  815. }
  816. if (node.createTextRange) {
  817. var textRange = node.createTextRange();
  818. textRange.collapse(true);
  819. textRange.moveEnd('character', pos);
  820. textRange.moveStart('character', pos);
  821. textRange.select();
  822. return true;
  823. }
  824. if (node.setSelectionRange) {
  825. node.setSelectionRange(pos, pos);
  826. return true;
  827. }
  828. return false;
  829. },
  830. isValidValue = function (mask, value) {
  831. var reg = mask
  832. .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
  833. .replace(/_/g, '{digit+}')
  834. .replace(/([0-9]{1})/g, '{digit$1}')
  835. .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
  836. .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
  837. return (new RegExp(reg)).test(value);
  838. };
  839. options = $.extend(true, {}, options, _options);
  840. if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
  841. options.allowTimes = $.extend(true, [], _options.allowTimes);
  842. }
  843. if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
  844. options.weekends = $.extend(true, [], _options.weekends);
  845. }
  846. if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
  847. $.each(_options.highlightedDates, function (index, value) {
  848. var splitData = $.map(value.split(','), $.trim),
  849. exDesc,
  850. hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
  851. keyDate = hDate.date.dateFormat(options.formatDate);
  852. if (highlightedDates[keyDate] !== undefined) {
  853. exDesc = highlightedDates[keyDate].desc;
  854. if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
  855. highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
  856. }
  857. } else {
  858. highlightedDates[keyDate] = hDate;
  859. }
  860. });
  861. options.highlightedDates = $.extend(true, [], highlightedDates);
  862. }
  863. if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
  864. highlightedDates = $.extend(true, [], options.highlightedDates);
  865. $.each(_options.highlightedPeriods, function (index, value) {
  866. var splitData = $.map(value.split(','), $.trim),
  867. dateTest = Date.parseDate(splitData[0], options.formatDate), // start date
  868. dateEnd = Date.parseDate(splitData[1], options.formatDate),
  869. desc = splitData[2],
  870. hDate,
  871. keyDate,
  872. exDesc,
  873. style = splitData[3];
  874. while (dateTest <= dateEnd) {
  875. hDate = new HighlightedDate(dateTest, desc, style);
  876. keyDate = dateTest.dateFormat(options.formatDate);
  877. dateTest.setDate(dateTest.getDate() + 1);
  878. if (highlightedDates[keyDate] !== undefined) {
  879. exDesc = highlightedDates[keyDate].desc;
  880. if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
  881. highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
  882. }
  883. } else {
  884. highlightedDates[keyDate] = hDate;
  885. }
  886. }
  887. });
  888. options.highlightedDates = $.extend(true, [], highlightedDates);
  889. }
  890. if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
  891. options.disabledDates = $.extend(true, [], _options.disabledDates);
  892. }
  893. if ((options.open || options.opened) && (!options.inline)) {
  894. input.trigger('open.xdsoft');
  895. }
  896. if (options.inline) {
  897. triggerAfterOpen = true;
  898. datetimepicker.addClass('xdsoft_inline');
  899. input.after(datetimepicker).hide();
  900. }
  901. if (options.inverseButton) {
  902. options.next = 'xdsoft_prev';
  903. options.prev = 'xdsoft_next';
  904. }
  905. if (options.datepicker) {
  906. datepicker.addClass('active');
  907. } else {
  908. datepicker.removeClass('active');
  909. }
  910. if (options.timepicker) {
  911. timepicker.addClass('active');
  912. } else {
  913. timepicker.removeClass('active');
  914. }
  915. if (options.value) {
  916. _xdsoft_datetime.setCurrentTime(options.value);
  917. if (input && input.val) {
  918. input.val(_xdsoft_datetime.str);
  919. }
  920. }
  921. if (isNaN(options.dayOfWeekStart)) {
  922. options.dayOfWeekStart = 0;
  923. } else {
  924. options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
  925. }
  926. if (!options.timepickerScrollbar) {
  927. timeboxparent.xdsoftScroller('hide');
  928. }
  929. if (options.minDate && /^-(.*)$/.test(options.minDate)) {
  930. options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate);
  931. }
  932. if (options.maxDate && /^\+(.*)$/.test(options.maxDate)) {
  933. options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate);
  934. }
  935. applyButton.toggle(options.showApplyButton);
  936. mounth_picker
  937. .find('.xdsoft_today_button')
  938. .css('visibility', !options.todayButton ? 'hidden' : 'visible');
  939. mounth_picker
  940. .find('.' + options.prev)
  941. .css('visibility', !options.prevButton ? 'hidden' : 'visible');
  942. mounth_picker
  943. .find('.' + options.next)
  944. .css('visibility', !options.nextButton ? 'hidden' : 'visible');
  945. if (options.mask) {
  946. input.off('keydown.xdsoft');
  947. if (options.mask === true) {
  948. options.mask = options.format
  949. .replace(/Y/g, '9999')
  950. .replace(/F/g, '9999')
  951. .replace(/m/g, '19')
  952. .replace(/d/g, '39')
  953. .replace(/H/g, '29')
  954. .replace(/i/g, '59')
  955. .replace(/s/g, '59');
  956. }
  957. if ($.type(options.mask) === 'string') {
  958. if (!isValidValue(options.mask, input.val())) {
  959. input.val(options.mask.replace(/[0-9]/g, '_'));
  960. }
  961. input.on('keydown.xdsoft', function (event) {
  962. var val = this.value,
  963. key = event.which,
  964. pos,
  965. digit;
  966. if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
  967. pos = getCaretPos(this);
  968. digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
  969. if ((key === BACKSPACE || key === DEL) && pos) {
  970. pos -= 1;
  971. digit = '_';
  972. }
  973. while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
  974. pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
  975. }
  976. val = val.substr(0, pos) + digit + val.substr(pos + 1);
  977. if ($.trim(val) === '') {
  978. val = options.mask.replace(/[0-9]/g, '_');
  979. } else {
  980. if (pos === options.mask.length) {
  981. event.preventDefault();
  982. return false;
  983. }
  984. }
  985. pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
  986. while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
  987. pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
  988. }
  989. if (isValidValue(options.mask, val)) {
  990. this.value = val;
  991. setCaretPos(this, pos);
  992. } else if ($.trim(val) === '') {
  993. this.value = options.mask.replace(/[0-9]/g, '_');
  994. } else {
  995. input.trigger('error_input.xdsoft');
  996. }
  997. } else {
  998. if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
  999. return true;
  1000. }
  1001. }
  1002. event.preventDefault();
  1003. return false;
  1004. });
  1005. }
  1006. }
  1007. if (options.validateOnBlur) {
  1008. input
  1009. .off('blur.xdsoft')
  1010. .on('blur.xdsoft', function () {
  1011. if (options.allowBlank && !$.trim($(this).val()).length) {
  1012. $(this).val(null);
  1013. datetimepicker.data('xdsoft_datetime').empty();
  1014. } else if (!Date.parseDate($(this).val(), options.format)) {
  1015. var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
  1016. splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
  1017. // parse the numbers as 0312 => 03:12
  1018. if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
  1019. $(this).val([splittedHours, splittedMinutes].map(function (item) {
  1020. return item > 9 ? item : '0' + item;
  1021. }).join(':'));
  1022. } else {
  1023. $(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
  1024. }
  1025. datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
  1026. } else {
  1027. datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
  1028. }
  1029. datetimepicker.trigger('changedatetime.xdsoft');
  1030. });
  1031. }
  1032. options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
  1033. datetimepicker
  1034. .trigger('xchange.xdsoft')
  1035. .trigger('afterOpen.xdsoft');
  1036. };
  1037. datetimepicker
  1038. .data('options', options)
  1039. .on('mousedown.xdsoft', function (event) {
  1040. event.stopPropagation();
  1041. event.preventDefault();
  1042. yearselect.hide();
  1043. monthselect.hide();
  1044. return false;
  1045. });
  1046. //scroll_element = timepicker.find('.xdsoft_time_box');
  1047. timeboxparent.append(timebox);
  1048. timeboxparent.xdsoftScroller();
  1049. datetimepicker.on('afterOpen.xdsoft', function () {
  1050. timeboxparent.xdsoftScroller();
  1051. });
  1052. datetimepicker
  1053. .append(datepicker)
  1054. .append(timepicker);
  1055. if (options.withoutCopyright !== true) {
  1056. datetimepicker
  1057. .append(xdsoft_copyright);
  1058. }
  1059. datepicker
  1060. .append(mounth_picker)
  1061. .append(calendar)
  1062. .append(applyButton);
  1063. $(options.parentID)
  1064. .append(datetimepicker);
  1065. XDSoft_datetime = function () {
  1066. var _this = this;
  1067. _this.now = function (norecursion) {
  1068. var d = new Date(),
  1069. date,
  1070. time;
  1071. if (!norecursion && options.defaultDate) {
  1072. date = _this.strToDateTime(options.defaultDate);
  1073. d.setFullYear(date.getFullYear());
  1074. d.setMonth(date.getMonth());
  1075. d.setDate(date.getDate());
  1076. }
  1077. if (options.yearOffset) {
  1078. d.setFullYear(d.getFullYear() + options.yearOffset);
  1079. }
  1080. if (!norecursion && options.defaultTime) {
  1081. time = _this.strtotime(options.defaultTime);
  1082. d.setHours(time.getHours());
  1083. d.setMinutes(time.getMinutes());
  1084. }
  1085. return d;
  1086. };
  1087. _this.isValidDate = function (d) {
  1088. if (Object.prototype.toString.call(d) !== "[object Date]") {
  1089. return false;
  1090. }
  1091. return !isNaN(d.getTime());
  1092. };
  1093. _this.setCurrentTime = function (dTime) {
  1094. _this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now();
  1095. datetimepicker.trigger('xchange.xdsoft');
  1096. };
  1097. _this.empty = function () {
  1098. _this.currentTime = null;
  1099. };
  1100. _this.getCurrentTime = function (dTime) {
  1101. return _this.currentTime;
  1102. };
  1103. _this.nextMonth = function () {
  1104. if (_this.currentTime === undefined || _this.currentTime === null) {
  1105. _this.currentTime = _this.now();
  1106. }
  1107. var month = _this.currentTime.getMonth() + 1,
  1108. year;
  1109. if (month === 12) {
  1110. _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
  1111. month = 0;
  1112. }
  1113. year = _this.currentTime.getFullYear();
  1114. _this.currentTime.setDate(
  1115. Math.min(
  1116. new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
  1117. _this.currentTime.getDate()
  1118. )
  1119. );
  1120. _this.currentTime.setMonth(month);
  1121. if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
  1122. options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1123. }
  1124. if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
  1125. options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1126. }
  1127. datetimepicker.trigger('xchange.xdsoft');
  1128. return month;
  1129. };
  1130. _this.prevMonth = function () {
  1131. if (_this.currentTime === undefined || _this.currentTime === null) {
  1132. _this.currentTime = _this.now();
  1133. }
  1134. var month = _this.currentTime.getMonth() - 1;
  1135. if (month === -1) {
  1136. _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
  1137. month = 11;
  1138. }
  1139. _this.currentTime.setDate(
  1140. Math.min(
  1141. new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
  1142. _this.currentTime.getDate()
  1143. )
  1144. );
  1145. _this.currentTime.setMonth(month);
  1146. if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
  1147. options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1148. }
  1149. datetimepicker.trigger('xchange.xdsoft');
  1150. return month;
  1151. };
  1152. _this.getWeekOfYear = function (datetime) {
  1153. var onejan = new Date(datetime.getFullYear(), 0, 1);
  1154. return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
  1155. };
  1156. _this.strToDateTime = function (sDateTime) {
  1157. var tmpDate = [], timeOffset, currentTime;
  1158. if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
  1159. return sDateTime;
  1160. }
  1161. tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
  1162. if (tmpDate) {
  1163. tmpDate[2] = Date.parseDate(tmpDate[2], options.formatDate);
  1164. }
  1165. if (tmpDate && tmpDate[2]) {
  1166. timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
  1167. currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
  1168. } else {
  1169. currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now();
  1170. }
  1171. if (!_this.isValidDate(currentTime)) {
  1172. currentTime = _this.now();
  1173. }
  1174. return currentTime;
  1175. };
  1176. _this.strToDate = function (sDate) {
  1177. if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
  1178. return sDate;
  1179. }
  1180. var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true);
  1181. if (!_this.isValidDate(currentTime)) {
  1182. currentTime = _this.now(true);
  1183. }
  1184. return currentTime;
  1185. };
  1186. _this.strtotime = function (sTime) {
  1187. if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
  1188. return sTime;
  1189. }
  1190. var currentTime = sTime ? Date.parseDate(sTime, options.formatTime) : _this.now(true);
  1191. if (!_this.isValidDate(currentTime)) {
  1192. currentTime = _this.now(true);
  1193. }
  1194. return currentTime;
  1195. };
  1196. _this.str = function () {
  1197. return _this.currentTime.dateFormat(options.format);
  1198. };
  1199. _this.currentTime = this.now();
  1200. };
  1201. _xdsoft_datetime = new XDSoft_datetime();
  1202. applyButton.on('click', function (e) {//pathbrite
  1203. e.preventDefault();
  1204. datetimepicker.data('changed', true);
  1205. _xdsoft_datetime.setCurrentTime(getCurrentValue());
  1206. input.val(_xdsoft_datetime.str());
  1207. datetimepicker.trigger('close.xdsoft');
  1208. });
  1209. mounth_picker
  1210. .find('.xdsoft_today_button')
  1211. .on('mousedown.xdsoft', function () {
  1212. datetimepicker.data('changed', true);
  1213. _xdsoft_datetime.setCurrentTime(0);
  1214. datetimepicker.trigger('afterOpen.xdsoft');
  1215. }).on('dblclick.xdsoft', function () {
  1216. var currentDate = _xdsoft_datetime.getCurrentTime();
  1217. currentDate = new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate());
  1218. var minDate = _xdsoft_datetime.strToDate(options.minDate);
  1219. minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
  1220. if(currentDate < minDate) {
  1221. return;
  1222. }
  1223. var maxDate = _xdsoft_datetime.strToDate(options.maxDate);
  1224. maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate());
  1225. if(currentDate > maxDate) {
  1226. return;
  1227. }
  1228. input.val(_xdsoft_datetime.str());
  1229. datetimepicker.trigger('close.xdsoft');
  1230. });
  1231. mounth_picker
  1232. .find('.xdsoft_prev,.xdsoft_next')
  1233. .on('mousedown.xdsoft', function () {
  1234. var $this = $(this),
  1235. timer = 0,
  1236. stop = false;
  1237. (function arguments_callee1(v) {
  1238. if ($this.hasClass(options.next)) {
  1239. _xdsoft_datetime.nextMonth();
  1240. } else if ($this.hasClass(options.prev)) {
  1241. _xdsoft_datetime.prevMonth();
  1242. }
  1243. if (options.monthChangeSpinner) {
  1244. if (!stop) {
  1245. timer = setTimeout(arguments_callee1, v || 100);
  1246. }
  1247. }
  1248. }(500));
  1249. $([document.body, window]).on('mouseup.xdsoft', function arguments_callee2() {
  1250. clearTimeout(timer);
  1251. stop = true;
  1252. $([document.body, window]).off('mouseup.xdsoft', arguments_callee2);
  1253. });
  1254. });
  1255. timepicker
  1256. .find('.xdsoft_prev,.xdsoft_next')
  1257. .on('mousedown.xdsoft', function () {
  1258. var $this = $(this),
  1259. timer = 0,
  1260. stop = false,
  1261. period = 110;
  1262. (function arguments_callee4(v) {
  1263. var pheight = timeboxparent[0].clientHeight,
  1264. height = timebox[0].offsetHeight,
  1265. top = Math.abs(parseInt(timebox.css('marginTop'), 10));
  1266. if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
  1267. timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
  1268. } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
  1269. timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
  1270. }
  1271. timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
  1272. period = (period > 10) ? 10 : period - 10;
  1273. if (!stop) {
  1274. timer = setTimeout(arguments_callee4, v || period);
  1275. }
  1276. }(500));
  1277. $([document.body, window]).on('mouseup.xdsoft', function arguments_callee5() {
  1278. clearTimeout(timer);
  1279. stop = true;
  1280. $([document.body, window])
  1281. .off('mouseup.xdsoft', arguments_callee5);
  1282. });
  1283. });
  1284. xchangeTimer = 0;
  1285. // base handler - generating a calendar and timepicker
  1286. datetimepicker
  1287. .on('xchange.xdsoft', function (event) {
  1288. clearTimeout(xchangeTimer);
  1289. xchangeTimer = setTimeout(function () {
  1290. if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
  1291. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1292. }
  1293. var table = '',
  1294. start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
  1295. i = 0,
  1296. j,
  1297. today = _xdsoft_datetime.now(),
  1298. maxDate = false,
  1299. minDate = false,
  1300. hDate,
  1301. d,
  1302. y,
  1303. m,
  1304. w,
  1305. classes = [],
  1306. customDateSettings,
  1307. newRow = true,
  1308. time = '',
  1309. h = '',
  1310. line_time,
  1311. description;
  1312. while (start.getDay() !== options.dayOfWeekStart) {
  1313. start.setDate(start.getDate() - 1);
  1314. }
  1315. table += '<table><thead><tr>';
  1316. if (options.weeks) {
  1317. table += '<th></th>';
  1318. }
  1319. for (j = 0; j < 7; j += 1) {
  1320. table += '<th>' + options.i18n[options.lang].dayOfWeek[(j + options.dayOfWeekStart) % 7] + '</th>';
  1321. }
  1322. table += '</tr></thead>';
  1323. table += '<tbody>';
  1324. if (options.maxDate !== false) {
  1325. maxDate = _xdsoft_datetime.strToDate(options.maxDate);
  1326. maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
  1327. }
  1328. if (options.minDate !== false) {
  1329. minDate = _xdsoft_datetime.strToDate(options.minDate);
  1330. minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
  1331. }
  1332. while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
  1333. classes = [];
  1334. i += 1;
  1335. d = start.getDate();
  1336. y = start.getFullYear();
  1337. m = start.getMonth();
  1338. w = _xdsoft_datetime.getWeekOfYear(start);
  1339. description = '';
  1340. classes.push('xdsoft_date');
  1341. if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
  1342. customDateSettings = options.beforeShowDay.call(datetimepicker, start);
  1343. } else {
  1344. customDateSettings = null;
  1345. }
  1346. if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
  1347. classes.push('xdsoft_disabled');
  1348. } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) {
  1349. classes.push('xdsoft_disabled');
  1350. }
  1351. if (customDateSettings && customDateSettings[1] !== "") {
  1352. classes.push(customDateSettings[1]);
  1353. }
  1354. if (_xdsoft_datetime.currentTime.getMonth() !== m) {
  1355. classes.push('xdsoft_other_month');
  1356. }
  1357. if ((options.defaultSelect || datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
  1358. classes.push('xdsoft_current');
  1359. }
  1360. if (today.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
  1361. classes.push('xdsoft_today');
  1362. }
  1363. if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) {
  1364. classes.push('xdsoft_weekend');
  1365. }
  1366. if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) {
  1367. hDate = options.highlightedDates[start.dateFormat(options.formatDate)];
  1368. classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
  1369. description = hDate.desc === undefined ? '' : hDate.desc;
  1370. }
  1371. if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
  1372. classes.push(options.beforeShowDay(start));
  1373. }
  1374. if (newRow) {
  1375. table += '<tr>';
  1376. newRow = false;
  1377. if (options.weeks) {
  1378. table += '<th>' + w + '</th>';
  1379. }
  1380. }
  1381. table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
  1382. '<div>' + d + '</div>' +
  1383. '</td>';
  1384. if (start.getDay() === options.dayOfWeekStartPrev) {
  1385. table += '</tr>';
  1386. newRow = true;
  1387. }
  1388. start.setDate(d + 1);
  1389. }
  1390. table += '</tbody></table>';
  1391. calendar.html(table);
  1392. mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
  1393. mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
  1394. // generate timebox
  1395. time = '';
  1396. h = '';
  1397. m = '';
  1398. line_time = function line_time(h, m) {
  1399. var now = _xdsoft_datetime.now(), optionDateTime, current_time;
  1400. now.setHours(h);
  1401. h = parseInt(now.getHours(), 10);
  1402. now.setMinutes(m);
  1403. m = parseInt(now.getMinutes(), 10);
  1404. optionDateTime = new Date(_xdsoft_datetime.currentTime);
  1405. optionDateTime.setHours(h);
  1406. optionDateTime.setMinutes(m);
  1407. classes = [];
  1408. 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())) {
  1409. classes.push('xdsoft_disabled');
  1410. }
  1411. current_time = new Date(_xdsoft_datetime.currentTime);
  1412. current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
  1413. current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
  1414. if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) {
  1415. if (options.defaultSelect || datetimepicker.data('changed')) {
  1416. classes.push('xdsoft_current');
  1417. } else if (options.initTime) {
  1418. classes.push('xdsoft_init_time');
  1419. }
  1420. }
  1421. if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
  1422. classes.push('xdsoft_today');
  1423. }
  1424. time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + now.dateFormat(options.formatTime) + '</div>';
  1425. };
  1426. if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
  1427. for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
  1428. for (j = 0; j < 60; j += options.step) {
  1429. h = (i < 10 ? '0' : '') + i;
  1430. m = (j < 10 ? '0' : '') + j;
  1431. line_time(h, m);
  1432. }
  1433. }
  1434. } else {
  1435. for (i = 0; i < options.allowTimes.length; i += 1) {
  1436. h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
  1437. m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
  1438. line_time(h, m);
  1439. }
  1440. }
  1441. timebox.html(time);
  1442. opt = '';
  1443. i = 0;
  1444. for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
  1445. opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
  1446. }
  1447. yearselect.children().eq(0)
  1448. .html(opt);
  1449. for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
  1450. opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>';
  1451. }
  1452. monthselect.children().eq(0).html(opt);
  1453. $(datetimepicker)
  1454. .trigger('generate.xdsoft');
  1455. }, 10);
  1456. event.stopPropagation();
  1457. })
  1458. .on('afterOpen.xdsoft', function () {
  1459. if (options.timepicker) {
  1460. var classType, pheight, height, top;
  1461. if (timebox.find('.xdsoft_current').length) {
  1462. classType = '.xdsoft_current';
  1463. } else if (timebox.find('.xdsoft_init_time').length) {
  1464. classType = '.xdsoft_init_time';
  1465. }
  1466. if (classType) {
  1467. pheight = timeboxparent[0].clientHeight;
  1468. height = timebox[0].offsetHeight;
  1469. top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
  1470. if ((height - pheight) < top) {
  1471. top = height - pheight;
  1472. }
  1473. timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
  1474. } else {
  1475. timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
  1476. }
  1477. }
  1478. });
  1479. timerclick = 0;
  1480. calendar
  1481. .on('click.xdsoft', 'td', function (xdevent) {
  1482. xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
  1483. timerclick += 1;
  1484. var $this = $(this),
  1485. currentTime = _xdsoft_datetime.currentTime;
  1486. if (currentTime === undefined || currentTime === null) {
  1487. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1488. currentTime = _xdsoft_datetime.currentTime;
  1489. }
  1490. if ($this.hasClass('xdsoft_disabled')) {
  1491. return false;
  1492. }
  1493. currentTime.setDate(1);
  1494. currentTime.setFullYear($this.data('year'));
  1495. currentTime.setMonth($this.data('month'));
  1496. currentTime.setDate($this.data('date'));
  1497. datetimepicker.trigger('select.xdsoft', [currentTime]);
  1498. input.val(_xdsoft_datetime.str());
  1499. if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === 0 && !options.timepicker))) && !options.inline) {
  1500. datetimepicker.trigger('close.xdsoft');
  1501. }
  1502. if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
  1503. options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
  1504. }
  1505. datetimepicker.data('changed', true);
  1506. datetimepicker.trigger('xchange.xdsoft');
  1507. datetimepicker.trigger('changedatetime.xdsoft');
  1508. setTimeout(function () {
  1509. timerclick = 0;
  1510. }, 200);
  1511. });
  1512. timebox
  1513. .on('click.xdsoft', 'div', function (xdevent) {
  1514. xdevent.stopPropagation();
  1515. var $this = $(this),
  1516. currentTime = _xdsoft_datetime.currentTime;
  1517. if (currentTime === undefined || currentTime === null) {
  1518. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1519. currentTime = _xdsoft_datetime.currentTime;
  1520. }
  1521. if ($this.hasClass('xdsoft_disabled')) {
  1522. return false;
  1523. }
  1524. currentTime.setHours($this.data('hour'));
  1525. currentTime.setMinutes($this.data('minute'));
  1526. datetimepicker.trigger('select.xdsoft', [currentTime]);
  1527. datetimepicker.data('input').val(_xdsoft_datetime.str());
  1528. if (options.inline !== true && options.closeOnTimeSelect === true) {
  1529. datetimepicker.trigger('close.xdsoft');
  1530. }
  1531. if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
  1532. options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
  1533. }
  1534. datetimepicker.data('changed', true);
  1535. datetimepicker.trigger('xchange.xdsoft');
  1536. datetimepicker.trigger('changedatetime.xdsoft');
  1537. });
  1538. datepicker
  1539. .on('mousewheel.xdsoft', function (event) {
  1540. if (!options.scrollMonth) {
  1541. return true;
  1542. }
  1543. if (event.deltaY < 0) {
  1544. _xdsoft_datetime.nextMonth();
  1545. } else {
  1546. _xdsoft_datetime.prevMonth();
  1547. }
  1548. return false;
  1549. });
  1550. input
  1551. .on('mousewheel.xdsoft', function (event) {
  1552. if (!options.scrollInput) {
  1553. return true;
  1554. }
  1555. if (!options.datepicker && options.timepicker) {
  1556. current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
  1557. if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
  1558. current_time_index += event.deltaY;
  1559. }
  1560. if (timebox.children().eq(current_time_index).length) {
  1561. timebox.children().eq(current_time_index).trigger('mousedown');
  1562. }
  1563. return false;
  1564. }
  1565. if (options.datepicker && !options.timepicker) {
  1566. datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
  1567. if (input.val) {
  1568. input.val(_xdsoft_datetime.str());
  1569. }
  1570. datetimepicker.trigger('changedatetime.xdsoft');
  1571. return false;
  1572. }
  1573. });
  1574. datetimepicker
  1575. .on('changedatetime.xdsoft', function (event) {
  1576. if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
  1577. var $input = datetimepicker.data('input');
  1578. options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
  1579. delete options.value;
  1580. $input.trigger('change');
  1581. }
  1582. })
  1583. .on('generate.xdsoft', function () {
  1584. if (options.onGenerate && $.isFunction(options.onGenerate)) {
  1585. options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1586. }
  1587. if (triggerAfterOpen) {
  1588. datetimepicker.trigger('afterOpen.xdsoft');
  1589. triggerAfterOpen = false;
  1590. }
  1591. })
  1592. .on('click.xdsoft', function (xdevent) {
  1593. xdevent.stopPropagation();
  1594. });
  1595. current_time_index = 0;
  1596. setPos = function () {
  1597. var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute";
  1598. if (options.fixed) {
  1599. top -= $(window).scrollTop();
  1600. left -= $(window).scrollLeft();
  1601. position = "fixed";
  1602. } else {
  1603. if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) {
  1604. top = offset.top - datetimepicker[0].offsetHeight + 1;
  1605. }
  1606. if (top < 0) {
  1607. top = 0;
  1608. }
  1609. if (left + datetimepicker[0].offsetWidth > $(window).width()) {
  1610. left = $(window).width() - datetimepicker[0].offsetWidth;
  1611. }
  1612. }
  1613. var node = datetimepicker[0]
  1614. do {
  1615. node = node.parentNode;
  1616. if(window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
  1617. left = left - (($(window).width() - node.offsetWidth)/2)
  1618. break
  1619. }
  1620. } while(node.nodeName != 'HTML')
  1621. datetimepicker.css({
  1622. left: left,
  1623. top: top,
  1624. position: position
  1625. });
  1626. };
  1627. datetimepicker
  1628. .on('open.xdsoft', function (event) {
  1629. var onShow = true;
  1630. if (options.onShow && $.isFunction(options.onShow)) {
  1631. onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
  1632. }
  1633. if (onShow !== false) {
  1634. datetimepicker.show();
  1635. setPos();
  1636. $(window)
  1637. .off('resize.xdsoft', setPos)
  1638. .on('resize.xdsoft', setPos);
  1639. if (options.closeOnWithoutClick) {
  1640. $([document.body, window]).on('mousedown.xdsoft', function arguments_callee6() {
  1641. datetimepicker.trigger('close.xdsoft');
  1642. $([document.body, window]).off('mousedown.xdsoft', arguments_callee6);
  1643. });
  1644. }
  1645. }
  1646. })
  1647. .on('close.xdsoft', function (event) {
  1648. var onClose = true;
  1649. mounth_picker
  1650. .find('.xdsoft_month,.xdsoft_year')
  1651. .find('.xdsoft_select')
  1652. .hide();
  1653. if (options.onClose && $.isFunction(options.onClose)) {
  1654. onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
  1655. }
  1656. if (onClose !== false && !options.opened && !options.inline) {
  1657. datetimepicker.hide();
  1658. }
  1659. event.stopPropagation();
  1660. })
  1661. .on('toggle.xdsoft', function (event) {
  1662. if (datetimepicker.is(':visible')) {
  1663. datetimepicker.trigger('close.xdsoft');
  1664. } else {
  1665. datetimepicker.trigger('open.xdsoft');
  1666. }
  1667. })
  1668. .data('input', input);
  1669. timer = 0;
  1670. timer1 = 0;
  1671. datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
  1672. datetimepicker.setOptions(options);
  1673. function getCurrentValue() {
  1674. var ct = false, time;
  1675. if (options.startDate) {
  1676. ct = _xdsoft_datetime.strToDate(options.startDate);
  1677. } else {
  1678. ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
  1679. if (ct) {
  1680. ct = _xdsoft_datetime.strToDateTime(ct);
  1681. } else if (options.defaultDate) {
  1682. ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
  1683. if (options.defaultTime) {
  1684. time = _xdsoft_datetime.strtotime(options.defaultTime);
  1685. ct.setHours(time.getHours());
  1686. ct.setMinutes(time.getMinutes());
  1687. }
  1688. }
  1689. }
  1690. if (ct && _xdsoft_datetime.isValidDate(ct)) {
  1691. datetimepicker.data('changed', true);
  1692. } else {
  1693. ct = '';
  1694. }
  1695. return ct || 0;
  1696. }
  1697. _xdsoft_datetime.setCurrentTime(getCurrentValue());
  1698. input
  1699. .data('xdsoft_datetimepicker', datetimepicker)
  1700. .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) {
  1701. if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
  1702. return;
  1703. }
  1704. clearTimeout(timer);
  1705. timer = setTimeout(function () {
  1706. if (input.is(':disabled')) {
  1707. return;
  1708. }
  1709. triggerAfterOpen = true;
  1710. _xdsoft_datetime.setCurrentTime(getCurrentValue());
  1711. datetimepicker.trigger('open.xdsoft');
  1712. }, 100);
  1713. })
  1714. .on('keydown.xdsoft', function (event) {
  1715. var val = this.value, elementSelector,
  1716. key = event.which;
  1717. if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
  1718. elementSelector = $("input:visible,textarea:visible");
  1719. datetimepicker.trigger('close.xdsoft');
  1720. elementSelector.eq(elementSelector.index(this) + 1).focus();
  1721. return false;
  1722. }
  1723. if ([TAB].indexOf(key) !== -1) {
  1724. datetimepicker.trigger('close.xdsoft');
  1725. return true;
  1726. }
  1727. });
  1728. };
  1729. destroyDateTimePicker = function (input) {
  1730. var datetimepicker = input.data('xdsoft_datetimepicker');
  1731. if (datetimepicker) {
  1732. datetimepicker.data('xdsoft_datetime', null);
  1733. datetimepicker.remove();
  1734. input
  1735. .data('xdsoft_datetimepicker', null)
  1736. .off('.xdsoft');
  1737. $(window).off('resize.xdsoft');
  1738. $([window, document.body]).off('mousedown.xdsoft');
  1739. if (input.unmousewheel) {
  1740. input.unmousewheel();
  1741. }
  1742. }
  1743. };
  1744. $(document)
  1745. .off('keydown.xdsoftctrl keyup.xdsoftctrl')
  1746. .on('keydown.xdsoftctrl', function (e) {
  1747. if (e.keyCode === CTRLKEY) {
  1748. ctrlDown = true;
  1749. }
  1750. })
  1751. .on('keyup.xdsoftctrl', function (e) {
  1752. if (e.keyCode === CTRLKEY) {
  1753. ctrlDown = false;
  1754. }
  1755. });
  1756. return this.each(function () {
  1757. var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
  1758. if (datetimepicker) {
  1759. if ($.type(opt) === 'string') {
  1760. switch (opt) {
  1761. case 'show':
  1762. $(this).select().focus();
  1763. datetimepicker.trigger('open.xdsoft');
  1764. break;
  1765. case 'hide':
  1766. datetimepicker.trigger('close.xdsoft');
  1767. break;
  1768. case 'toggle':
  1769. datetimepicker.trigger('toggle.xdsoft');
  1770. break;
  1771. case 'destroy':
  1772. destroyDateTimePicker($(this));
  1773. break;
  1774. case 'reset':
  1775. this.value = this.defaultValue;
  1776. if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) {
  1777. datetimepicker.data('changed', false);
  1778. }
  1779. datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
  1780. break;
  1781. case 'validate':
  1782. $input = datetimepicker.data('input');
  1783. $input.trigger('blur.xdsoft');
  1784. break;
  1785. }
  1786. } else {
  1787. datetimepicker
  1788. .setOptions(opt);
  1789. }
  1790. return 0;
  1791. }
  1792. if ($.type(opt) !== 'string') {
  1793. if (!options.lazyInit || options.open || options.inline) {
  1794. createDateTimePicker($(this));
  1795. } else {
  1796. lazyInit($(this));
  1797. }
  1798. }
  1799. });
  1800. };
  1801. $.fn.datetimepicker.defaults = default_options;
  1802. }(jQuery));
  1803. function HighlightedDate(date, desc, style) {
  1804. "use strict";
  1805. this.date = date;
  1806. this.desc = desc;
  1807. this.style = style;
  1808. }
  1809. (function () {
  1810. /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
  1811. * Licensed under the MIT License (LICENSE.txt).
  1812. *
  1813. * Version: 3.1.12
  1814. *
  1815. * Requires: jQuery 1.2.2+
  1816. */
  1817. !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)}})});
  1818. // Parse and Format Library
  1819. //http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
  1820. /*
  1821. * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
  1822. *
  1823. * This program is free software; you can redistribute it and/or modify it
  1824. * under the terms of the GNU Lesser General Public License as published by the
  1825. * Free Software Foundation, version 2.1.
  1826. *
  1827. * This program is distributed in the hope that it will be useful, but WITHOUT
  1828. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1829. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  1830. * details.
  1831. */
  1832. 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"};
  1833. }());