jquery.datetimepicker.full.js 113 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954
  1. /*!
  2. * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020
  3. * @version 1.3.6
  4. *
  5. * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
  6. * This library is a standalone javascript library and does not depend on other libraries or plugins like jQuery. The
  7. * library also adds support for Universal Module Definition (UMD).
  8. *
  9. * @see http://php.net/manual/en/function.date.php
  10. *
  11. * For more JQuery plugins visit http://plugins.krajee.com
  12. * For more Yii related demos visit http://demos.krajee.com
  13. */!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():t.DateFormatter=e()}("undefined"!=typeof self?self:this,function(){var t,e;return e={DAY:864e5,HOUR:3600,defaults:{dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,n={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&n[e]?n[e]:"th"}},separators:/[ \-+\/.:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},getInt:function(t,e){return parseInt(t,e?e:10)},compare:function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},lpad:function(t,n,r){var a=t.toString();return r=r||"0",a.length<n?e.lpad(r+a,n):a},merge:function(t){var n,r;for(t=t||{},n=1;n<arguments.length;n++)if(r=arguments[n])for(var a in r)r.hasOwnProperty(a)&&("object"==typeof r[a]?e.merge(t[a],r[a]):t[a]=r[a]);return t},getIndex:function(t,e){for(var n=0;n<e.length;n++)if(e[n].toLowerCase()===t.toLowerCase())return n;return-1}},t=function(t){var n=this,r=e.merge(e.defaults,t);n.dateSettings=r.dateSettings,n.separators=r.separators,n.validParts=r.validParts,n.intParts=r.intParts,n.tzParts=r.tzParts,n.tzClip=r.tzClip},t.prototype={constructor:t,getMonth:function(t){var n,r=this;return n=e.getIndex(t,r.dateSettings.monthsShort)+1,0===n&&(n=e.getIndex(t,r.dateSettings.months)+1),n},parseDate:function(t,n){var r,a,u,i,o,s,c,f,l,d,g=this,h=!1,m=!1,p=g.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!t)return null;if(t instanceof Date)return t;if("U"===n)return u=e.getInt(t),u?new Date(1e3*u):t;switch(typeof t){case"number":return new Date(t);case"string":break;default:return null}if(r=n.match(g.validParts),!r||0===r.length)throw new Error("Invalid date format definition.");for(u=r.length-1;u>=0;u--)"S"===r[u]&&r.splice(u,1);for(a=t.replace(g.separators,"\x00").split("\x00"),u=0;u<a.length;u++)switch(i=a[u],o=e.getInt(i),r[u]){case"y":case"Y":if(!o)return null;l=i.length,y.year=2===l?e.getInt((70>o?"20":"19")+i):o,h=!0;break;case"m":case"n":case"M":case"F":if(isNaN(o)){if(s=g.getMonth(i),!(s>0))return null;y.month=s}else{if(!(o>=1&&12>=o))return null;y.month=o}h=!0;break;case"d":case"j":if(!(o>=1&&31>=o))return null;y.day=o,h=!0;break;case"g":case"h":if(c=r.indexOf("a")>-1?r.indexOf("a"):r.indexOf("A")>-1?r.indexOf("A"):-1,d=a[c],-1!==c)f=e.compare(d,p.meridiem[0])?0:e.compare(d,p.meridiem[1])?12:-1,o>=1&&12>=o&&-1!==f?y.hour=o%12===0?f:o+f:o>=0&&23>=o&&(y.hour=o);else{if(!(o>=0&&23>=o))return null;y.hour=o}m=!0;break;case"G":case"H":if(!(o>=0&&23>=o))return null;y.hour=o,m=!0;break;case"i":if(!(o>=0&&59>=o))return null;y.min=o,m=!0;break;case"s":if(!(o>=0&&59>=o))return null;y.sec=o,m=!0}if(h===!0){var D=y.year||0,v=y.month?y.month-1:0,S=y.day||1;y.date=new Date(D,v,S,y.hour,y.min,y.sec,0)}else{if(m!==!0)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,n){if("string"!=typeof t)return t;var r,a,u,i,o,s,c=this,f=t.replace(c.separators,"\x00").split("\x00"),l=/^[djmn]/g,d=n.match(c.validParts),g=new Date,h=0;if(!l.test(d[0]))return t;for(u=0;u<f.length;u++){if(h=2,o=f[u],s=e.getInt(o.substr(0,2)),isNaN(s))return null;switch(u){case 0:"m"===d[0]||"n"===d[0]?g.setMonth(s-1):g.setDate(s);break;case 1:"m"===d[0]||"n"===d[0]?g.setDate(s):g.setMonth(s-1);break;case 2:if(a=g.getFullYear(),r=o.length,h=4>r?r:4,a=e.getInt(4>r?a.toString().substr(0,4-r)+o:o.substr(0,4)),!a)return null;g.setFullYear(a);break;case 3:g.setHours(s);break;case 4:g.setMinutes(s);break;case 5:g.setSeconds(s)}i=o.substr(h),i.length>0&&f.splice(u+1,0,i)}return g},parseFormat:function(t,n){var r,a=this,u=a.dateSettings,i=/\\?(.?)/gi,o=function(t,e){return r[t]?r[t]():e};return r={d:function(){return e.lpad(r.j(),2)},D:function(){return u.daysShort[r.w()]},j:function(){return n.getDate()},l:function(){return u.days[r.w()]},N:function(){return r.w()||7},w:function(){return n.getDay()},z:function(){var t=new Date(r.Y(),r.n()-1,r.j()),n=new Date(r.Y(),0,1);return Math.round((t-n)/e.DAY)},W:function(){var t=new Date(r.Y(),r.n()-1,r.j()-r.N()+3),n=new Date(t.getFullYear(),0,4);return e.lpad(1+Math.round((t-n)/e.DAY/7),2)},F:function(){return u.months[n.getMonth()]},m:function(){return e.lpad(r.n(),2)},M:function(){return u.monthsShort[n.getMonth()]},n:function(){return n.getMonth()+1},t:function(){return new Date(r.Y(),r.n(),0).getDate()},L:function(){var t=r.Y();return t%4===0&&t%100!==0||t%400===0?1:0},o:function(){var t=r.n(),e=r.W(),n=r.Y();return n+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return n.getFullYear()},y:function(){return r.Y().toString().slice(-2)},a:function(){return r.A().toLowerCase()},A:function(){var t=r.G()<12?0:1;return u.meridiem[t]},B:function(){var t=n.getUTCHours()*e.HOUR,r=60*n.getUTCMinutes(),a=n.getUTCSeconds();return e.lpad(Math.floor((t+r+a+e.HOUR)/86.4)%1e3,3)},g:function(){return r.G()%12||12},G:function(){return n.getHours()},h:function(){return e.lpad(r.g(),2)},H:function(){return e.lpad(r.G(),2)},i:function(){return e.lpad(n.getMinutes(),2)},s:function(){return e.lpad(n.getSeconds(),2)},u:function(){return e.lpad(1e3*n.getMilliseconds(),6)},e:function(){var t=/\((.*)\)/.exec(String(n))[1];return t||"Coordinated Universal Time"},I:function(){var t=new Date(r.Y(),0),e=Date.UTC(r.Y(),0),n=new Date(r.Y(),6),a=Date.UTC(r.Y(),6);return t-e!==n-a?1:0},O:function(){var t=n.getTimezoneOffset(),r=Math.abs(t);return(t>0?"-":"+")+e.lpad(100*Math.floor(r/60)+r%60,4)},P:function(){var t=r.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){var t=(String(n).match(a.tzParts)||[""]).pop().replace(a.tzClip,"");return t||"UTC"},Z:function(){return 60*-n.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(i,o)},r:function(){return"D, d M Y H:i:s O".replace(i,o)},U:function(){return n.getTime()/1e3||0}},o(t,t)},formatDate:function(t,n){var r,a,u,i,o,s=this,c="",f="\\";if("string"==typeof t&&(t=s.parseDate(t,n),!t))return null;if(t instanceof Date){for(u=n.length,r=0;u>r;r++)o=n.charAt(r),"S"!==o&&o!==f&&(r>0&&n.charAt(r-1)===f?c+=o:(i=s.parseFormat(o,t),r!==u-1&&s.intParts.test(o)&&"S"===n.charAt(r+1)&&(a=e.getInt(i)||0,i+=s.dateSettings.ordinal(a)),c+=i));return c}return""}},t});
  14. /**
  15. * @preserve jQuery DateTimePicker
  16. * @homepage http://xdsoft.net/jqplugins/datetimepicker/
  17. * @author Chupurnov Valeriy (<chupurnov@gmail.com>)
  18. */
  19. /**
  20. * @param {jQuery} $
  21. */
  22. var datetimepickerFactory = function ($) {
  23. 'use strict';
  24. var default_options = {
  25. i18n: {
  26. ar: { // Arabic
  27. months: [
  28. "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
  29. ],
  30. dayOfWeekShort: [
  31. "ن", "ث", "ع", "خ", "ج", "س", "ح"
  32. ],
  33. dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
  34. },
  35. ro: { // Romanian
  36. months: [
  37. "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
  38. ],
  39. dayOfWeekShort: [
  40. "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
  41. ],
  42. dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
  43. },
  44. id: { // Indonesian
  45. months: [
  46. "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
  47. ],
  48. dayOfWeekShort: [
  49. "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
  50. ],
  51. dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
  52. },
  53. is: { // Icelandic
  54. months: [
  55. "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
  56. ],
  57. dayOfWeekShort: [
  58. "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
  59. ],
  60. dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
  61. },
  62. bg: { // Bulgarian
  63. months: [
  64. "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
  65. ],
  66. dayOfWeekShort: [
  67. "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
  68. ],
  69. dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
  70. },
  71. fa: { // Persian/Farsi
  72. months: [
  73. 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
  74. ],
  75. dayOfWeekShort: [
  76. 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
  77. ],
  78. dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"]
  79. },
  80. ru: { // Russian
  81. months: [
  82. 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
  83. ],
  84. dayOfWeekShort: [
  85. "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
  86. ],
  87. dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
  88. },
  89. uk: { // Ukrainian
  90. months: [
  91. 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
  92. ],
  93. dayOfWeekShort: [
  94. "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
  95. ],
  96. dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
  97. },
  98. en: { // English
  99. months: [
  100. "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  101. ],
  102. dayOfWeekShort: [
  103. "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  104. ],
  105. dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
  106. },
  107. el: { // Ελληνικά
  108. months: [
  109. "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
  110. ],
  111. dayOfWeekShort: [
  112. "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
  113. ],
  114. dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
  115. },
  116. de: { // German
  117. months: [
  118. 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
  119. ],
  120. dayOfWeekShort: [
  121. "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
  122. ],
  123. dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
  124. },
  125. nl: { // Dutch
  126. months: [
  127. "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
  128. ],
  129. dayOfWeekShort: [
  130. "zo", "ma", "di", "wo", "do", "vr", "za"
  131. ],
  132. dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
  133. },
  134. tr: { // Turkish
  135. months: [
  136. "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
  137. ],
  138. dayOfWeekShort: [
  139. "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
  140. ],
  141. dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
  142. },
  143. fr: { //French
  144. months: [
  145. "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
  146. ],
  147. dayOfWeekShort: [
  148. "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
  149. ],
  150. dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
  151. },
  152. es: { // Spanish
  153. months: [
  154. "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
  155. ],
  156. dayOfWeekShort: [
  157. "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
  158. ],
  159. dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
  160. },
  161. th: { // Thai
  162. months: [
  163. 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
  164. ],
  165. dayOfWeekShort: [
  166. 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
  167. ],
  168. dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
  169. },
  170. pl: { // Polish
  171. months: [
  172. "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
  173. ],
  174. dayOfWeekShort: [
  175. "nd", "pn", "wt", "śr", "cz", "pt", "sb"
  176. ],
  177. dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
  178. },
  179. pt: { // Portuguese
  180. months: [
  181. "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
  182. ],
  183. dayOfWeekShort: [
  184. "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
  185. ],
  186. dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
  187. },
  188. ch: { // Simplified Chinese
  189. months: [
  190. "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
  191. ],
  192. dayOfWeekShort: [
  193. "日", "一", "二", "三", "四", "五", "六"
  194. ]
  195. },
  196. se: { // Swedish
  197. months: [
  198. "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
  199. ],
  200. dayOfWeekShort: [
  201. "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
  202. ]
  203. },
  204. km: { // Khmer (ភាសាខ្មែរ)
  205. months: [
  206. "មករា​", "កុម្ភៈ", "មិនា​", "មេសា​", "ឧសភា​", "មិថុនា​", "កក្កដា​", "សីហា​", "កញ្ញា​", "តុលា​", "វិច្ឆិកា", "ធ្នូ​"
  207. ],
  208. dayOfWeekShort: ["អាទិ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហ​​", "សុក្រ​", "សៅរ៍"],
  209. dayOfWeek: ["អាទិត្យ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហស្បតិ៍​", "សុក្រ​", "សៅរ៍"]
  210. },
  211. kr: { // Korean
  212. months: [
  213. "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
  214. ],
  215. dayOfWeekShort: [
  216. "일", "월", "화", "수", "목", "금", "토"
  217. ],
  218. dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
  219. },
  220. it: { // Italian
  221. months: [
  222. "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
  223. ],
  224. dayOfWeekShort: [
  225. "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
  226. ],
  227. dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
  228. },
  229. da: { // Dansk
  230. months: [
  231. "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"
  232. ],
  233. dayOfWeekShort: [
  234. "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
  235. ],
  236. dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
  237. },
  238. no: { // Norwegian
  239. months: [
  240. "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
  241. ],
  242. dayOfWeekShort: [
  243. "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
  244. ],
  245. dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
  246. },
  247. ja: { // Japanese
  248. months: [
  249. "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
  250. ],
  251. dayOfWeekShort: [
  252. "日", "月", "火", "水", "木", "金", "土"
  253. ],
  254. dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
  255. },
  256. vi: { // Vietnamese
  257. months: [
  258. "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"
  259. ],
  260. dayOfWeekShort: [
  261. "CN", "T2", "T3", "T4", "T5", "T6", "T7"
  262. ],
  263. dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
  264. },
  265. sl: { // Slovenščina
  266. months: [
  267. "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
  268. ],
  269. dayOfWeekShort: [
  270. "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
  271. ],
  272. dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
  273. },
  274. cs: { // Čeština
  275. months: [
  276. "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
  277. ],
  278. dayOfWeekShort: [
  279. "Ne", "Po", "Út", "St", "Čt", "Pá", "So"
  280. ]
  281. },
  282. hu: { // Hungarian
  283. months: [
  284. "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
  285. ],
  286. dayOfWeekShort: [
  287. "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
  288. ],
  289. dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
  290. },
  291. az: { //Azerbaijanian (Azeri)
  292. months: [
  293. "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
  294. ],
  295. dayOfWeekShort: [
  296. "B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
  297. ],
  298. dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
  299. },
  300. bs: { //Bosanski
  301. months: [
  302. "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
  303. ],
  304. dayOfWeekShort: [
  305. "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
  306. ],
  307. dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
  308. },
  309. ca: { //Català
  310. months: [
  311. "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
  312. ],
  313. dayOfWeekShort: [
  314. "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
  315. ],
  316. dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
  317. },
  318. 'en-GB': { //English (British)
  319. months: [
  320. "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  321. ],
  322. dayOfWeekShort: [
  323. "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  324. ],
  325. dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
  326. },
  327. et: { //"Eesti"
  328. months: [
  329. "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
  330. ],
  331. dayOfWeekShort: [
  332. "P", "E", "T", "K", "N", "R", "L"
  333. ],
  334. dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
  335. },
  336. eu: { //Euskara
  337. months: [
  338. "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
  339. ],
  340. dayOfWeekShort: [
  341. "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
  342. ],
  343. dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
  344. },
  345. fi: { //Finnish (Suomi)
  346. months: [
  347. "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
  348. ],
  349. dayOfWeekShort: [
  350. "Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
  351. ],
  352. dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
  353. },
  354. gl: { //Galego
  355. months: [
  356. "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
  357. ],
  358. dayOfWeekShort: [
  359. "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
  360. ],
  361. dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
  362. },
  363. hr: { //Hrvatski
  364. months: [
  365. "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
  366. ],
  367. dayOfWeekShort: [
  368. "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
  369. ],
  370. dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
  371. },
  372. ko: { //Korean (한국어)
  373. months: [
  374. "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
  375. ],
  376. dayOfWeekShort: [
  377. "일", "월", "화", "수", "목", "금", "토"
  378. ],
  379. dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
  380. },
  381. lt: { //Lithuanian (lietuvių)
  382. months: [
  383. "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
  384. ],
  385. dayOfWeekShort: [
  386. "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
  387. ],
  388. dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
  389. },
  390. lv: { //Latvian (Latviešu)
  391. months: [
  392. "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
  393. ],
  394. dayOfWeekShort: [
  395. "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
  396. ],
  397. dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
  398. },
  399. mk: { //Macedonian (Македонски)
  400. months: [
  401. "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
  402. ],
  403. dayOfWeekShort: [
  404. "нед", "пон", "вто", "сре", "чет", "пет", "саб"
  405. ],
  406. dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
  407. },
  408. mn: { //Mongolian (Монгол)
  409. months: [
  410. "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
  411. ],
  412. dayOfWeekShort: [
  413. "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
  414. ],
  415. dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
  416. },
  417. 'pt-BR': { //Português(Brasil)
  418. months: [
  419. "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
  420. ],
  421. dayOfWeekShort: [
  422. "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
  423. ],
  424. dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
  425. },
  426. sk: { //Slovenčina
  427. months: [
  428. "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
  429. ],
  430. dayOfWeekShort: [
  431. "Ne", "Po", "Ut", "St", "Št", "Pi", "So"
  432. ],
  433. dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
  434. },
  435. sq: { //Albanian (Shqip)
  436. months: [
  437. "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
  438. ],
  439. dayOfWeekShort: [
  440. "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
  441. ],
  442. dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
  443. },
  444. 'sr-YU': { //Serbian (Srpski)
  445. months: [
  446. "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
  447. ],
  448. dayOfWeekShort: [
  449. "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
  450. ],
  451. dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
  452. },
  453. sr: { //Serbian Cyrillic (Српски)
  454. months: [
  455. "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
  456. ],
  457. dayOfWeekShort: [
  458. "нед", "пон", "уто", "сре", "чет", "пет", "суб"
  459. ],
  460. dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
  461. },
  462. sv: { //Svenska
  463. months: [
  464. "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
  465. ],
  466. dayOfWeekShort: [
  467. "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
  468. ],
  469. dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
  470. },
  471. 'zh-TW': { //Traditional Chinese (繁體中文)
  472. months: [
  473. "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
  474. ],
  475. dayOfWeekShort: [
  476. "日", "一", "二", "三", "四", "五", "六"
  477. ],
  478. dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
  479. },
  480. zh: { //Simplified Chinese (简体中文)
  481. months: [
  482. "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
  483. ],
  484. dayOfWeekShort: [
  485. "日", "一", "二", "三", "四", "五", "六"
  486. ],
  487. dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
  488. },
  489. ug:{ // Uyghur(ئۇيغۇرچە)
  490. months: [
  491. "1-ئاي","2-ئاي","3-ئاي","4-ئاي","5-ئاي","6-ئاي","7-ئاي","8-ئاي","9-ئاي","10-ئاي","11-ئاي","12-ئاي"
  492. ],
  493. dayOfWeek: [
  494. "يەكشەنبە", "دۈشەنبە","سەيشەنبە","چارشەنبە","پەيشەنبە","جۈمە","شەنبە"
  495. ]
  496. },
  497. he: { //Hebrew (עברית)
  498. months: [
  499. 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
  500. ],
  501. dayOfWeekShort: [
  502. 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
  503. ],
  504. dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
  505. },
  506. hy: { // Armenian
  507. months: [
  508. "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
  509. ],
  510. dayOfWeekShort: [
  511. "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
  512. ],
  513. dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
  514. },
  515. kg: { // Kyrgyz
  516. months: [
  517. 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
  518. ],
  519. dayOfWeekShort: [
  520. "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
  521. ],
  522. dayOfWeek: [
  523. "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
  524. ]
  525. },
  526. rm: { // Romansh
  527. months: [
  528. "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
  529. ],
  530. dayOfWeekShort: [
  531. "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
  532. ],
  533. dayOfWeek: [
  534. "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
  535. ]
  536. },
  537. ka: { // Georgian
  538. months: [
  539. 'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი'
  540. ],
  541. dayOfWeekShort: [
  542. "კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
  543. ],
  544. dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
  545. },
  546. kk: { // Kazakh
  547. months: [
  548. 'Қаңтар', 'Ақпан', 'Наурыз', 'Сәуір', 'Мамыр', 'Маусым', 'Шілде', 'Тамыз', 'Қыркүйек', 'Қазан', 'Қараша', 'Желтоқсан'
  549. ],
  550. dayOfWeekShort: [
  551. "Жк", "Дс", "Сс", "Ср", "Бс", "Жм", "Сб"
  552. ],
  553. dayOfWeek: ["Жексенбі", "Дүйсенбі", "Сейсенбі", "Сәрсенбі", "Бейсенбі", "Жұма", "Сенбі"]
  554. }
  555. },
  556. ownerDocument: document,
  557. contentWindow: window,
  558. value: '',
  559. rtl: false,
  560. format: 'Y/m/d H:i',
  561. formatTime: 'H:i',
  562. formatDate: 'Y/m/d',
  563. startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
  564. step: 60,
  565. monthChangeSpinner: true,
  566. closeOnDateSelect: false,
  567. closeOnTimeSelect: true,
  568. closeOnWithoutClick: true,
  569. closeOnInputClick: true,
  570. openOnFocus: true,
  571. timepicker: true,
  572. datepicker: true,
  573. weeks: false,
  574. defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
  575. defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
  576. minDate: false,
  577. maxDate: false,
  578. minTime: false,
  579. maxTime: false,
  580. minDateTime: false,
  581. maxDateTime: false,
  582. allowTimes: [],
  583. opened: false,
  584. initTime: true,
  585. inline: false,
  586. theme: '',
  587. touchMovedThreshold: 5,
  588. onSelectDate: function () {},
  589. onSelectTime: function () {},
  590. onChangeMonth: function () {},
  591. onGetWeekOfYear: function () {},
  592. onChangeYear: function () {},
  593. onChangeDateTime: function () {},
  594. onShow: function () {},
  595. onClose: function () {},
  596. onGenerate: function () {},
  597. withoutCopyright: true,
  598. inverseButton: false,
  599. hours12: false,
  600. next: 'xdsoft_next',
  601. prev : 'xdsoft_prev',
  602. dayOfWeekStart: 0,
  603. parentID: 'body',
  604. timeHeightInTimePicker: 25,
  605. timepickerScrollbar: true,
  606. todayButton: true,
  607. prevButton: true,
  608. nextButton: true,
  609. defaultSelect: true,
  610. scrollMonth: true,
  611. scrollTime: true,
  612. scrollInput: true,
  613. lazyInit: false,
  614. mask: false,
  615. validateOnBlur: true,
  616. allowBlank: true,
  617. yearStart: 1950,
  618. yearEnd: 2050,
  619. monthStart: 0,
  620. monthEnd: 11,
  621. style: '',
  622. id: '',
  623. fixed: false,
  624. roundTime: 'round', // ceil, floor
  625. className: '',
  626. weekends: [],
  627. highlightedDates: [],
  628. highlightedPeriods: [],
  629. allowDates : [],
  630. allowDateRe : null,
  631. disabledDates : [],
  632. disabledWeekDays: [],
  633. yearOffset: 0,
  634. beforeShowDay: null,
  635. enterLikeTab: true,
  636. showApplyButton: false,
  637. insideParent: false,
  638. };
  639. var dateHelper = null,
  640. defaultDateHelper = null,
  641. globalLocaleDefault = 'en',
  642. globalLocale = 'en';
  643. var dateFormatterOptionsDefault = {
  644. meridiem: ['AM', 'PM']
  645. };
  646. var initDateFormatter = function(){
  647. var locale = default_options.i18n[globalLocale],
  648. opts = {
  649. days: locale.dayOfWeek,
  650. daysShort: locale.dayOfWeekShort,
  651. months: locale.months,
  652. monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
  653. };
  654. if (typeof DateFormatter === 'function') {
  655. dateHelper = defaultDateHelper = new DateFormatter({
  656. dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
  657. });
  658. }
  659. };
  660. var dateFormatters = {
  661. moment: {
  662. default_options:{
  663. format: 'YYYY/MM/DD HH:mm',
  664. formatDate: 'YYYY/MM/DD',
  665. formatTime: 'HH:mm',
  666. },
  667. formatter: {
  668. parseDate: function (date, format) {
  669. if(isFormatStandard(format)){
  670. return defaultDateHelper.parseDate(date, format);
  671. }
  672. var d = moment(date, format);
  673. return d.isValid() ? d.toDate() : false;
  674. },
  675. formatDate: function (date, format) {
  676. if(isFormatStandard(format)){
  677. return defaultDateHelper.formatDate(date, format);
  678. }
  679. return moment(date).format(format);
  680. },
  681. formatMask: function(format){
  682. return format
  683. .replace(/Y{4}/g, '9999')
  684. .replace(/Y{2}/g, '99')
  685. .replace(/M{2}/g, '19')
  686. .replace(/D{2}/g, '39')
  687. .replace(/H{2}/g, '29')
  688. .replace(/m{2}/g, '59')
  689. .replace(/s{2}/g, '59');
  690. },
  691. }
  692. }
  693. }
  694. // for locale settings
  695. $.datetimepicker = {
  696. setLocale: function(locale){
  697. var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
  698. if (globalLocale !== newLocale) {
  699. globalLocale = newLocale;
  700. // reinit date formatter
  701. initDateFormatter();
  702. }
  703. },
  704. setDateFormatter: function(dateFormatter) {
  705. if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){
  706. var df = dateFormatters[dateFormatter];
  707. $.extend(default_options, df.default_options);
  708. dateHelper = df.formatter;
  709. }
  710. else {
  711. dateHelper = dateFormatter;
  712. }
  713. },
  714. };
  715. var standardFormats = {
  716. RFC_2822: 'D, d M Y H:i:s O',
  717. ATOM: 'Y-m-d\TH:i:sP',
  718. ISO_8601: 'Y-m-d\TH:i:sO',
  719. RFC_822: 'D, d M y H:i:s O',
  720. RFC_850: 'l, d-M-y H:i:s T',
  721. RFC_1036: 'D, d M y H:i:s O',
  722. RFC_1123: 'D, d M Y H:i:s O',
  723. RSS: 'D, d M Y H:i:s O',
  724. W3C: 'Y-m-d\TH:i:sP'
  725. }
  726. var isFormatStandard = function(format){
  727. return Object.values(standardFormats).indexOf(format) === -1 ? false : true;
  728. }
  729. $.extend($.datetimepicker, standardFormats);
  730. // first init date formatter
  731. initDateFormatter();
  732. // fix for ie8
  733. if (!window.getComputedStyle) {
  734. window.getComputedStyle = function (el) {
  735. this.el = el;
  736. this.getPropertyValue = function (prop) {
  737. var re = /(-([a-z]))/g;
  738. if (prop === 'float') {
  739. prop = 'styleFloat';
  740. }
  741. if (re.test(prop)) {
  742. prop = prop.replace(re, function (a, b, c) {
  743. return c.toUpperCase();
  744. });
  745. }
  746. return el.currentStyle[prop] || null;
  747. };
  748. return this;
  749. };
  750. }
  751. if (!Array.prototype.indexOf) {
  752. Array.prototype.indexOf = function (obj, start) {
  753. var i, j;
  754. for (i = (start || 0), j = this.length; i < j; i += 1) {
  755. if (this[i] === obj) { return i; }
  756. }
  757. return -1;
  758. };
  759. }
  760. Date.prototype.countDaysInMonth = function () {
  761. return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
  762. };
  763. $.fn.xdsoftScroller = function (options, percent) {
  764. return this.each(function () {
  765. var timeboxparent = $(this),
  766. pointerEventToXY = function (e) {
  767. var out = {x: 0, y: 0},
  768. touch;
  769. if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
  770. touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
  771. out.x = touch.clientX;
  772. out.y = touch.clientY;
  773. } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
  774. out.x = e.clientX;
  775. out.y = e.clientY;
  776. }
  777. return out;
  778. },
  779. getWheelDelta = function (e) {
  780. var deltaY = 0;
  781. if ('detail' in e) { deltaY = e.detail; }
  782. if ('wheelDelta' in e) { deltaY = -e.wheelDelta / 120; }
  783. if ('wheelDeltaY' in e) { deltaY = -e.wheelDeltaY / 120; }
  784. if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { deltaY = 0; }
  785. deltaY *= 10;
  786. if ('deltaY' in e) { deltaY = -e.deltaY; }
  787. if (deltaY && e.deltaMode) {
  788. if (e.deltaMode === 1) {
  789. deltaY *= 40;
  790. } else {
  791. deltaY *= 800;
  792. }
  793. }
  794. return deltaY;
  795. },
  796. timebox,
  797. timeboxTop = 0,
  798. parentHeight,
  799. height,
  800. scrollbar,
  801. scroller,
  802. maximumOffset = 100,
  803. start = false,
  804. startY = 0,
  805. startTop = 0,
  806. h1 = 0,
  807. touchStart = false,
  808. startTopScroll = 0,
  809. calcOffset = function () {};
  810. if (percent === 'hide') {
  811. timeboxparent.find('.xdsoft_scrollbar').hide();
  812. return;
  813. }
  814. if (!$(this).hasClass('xdsoft_scroller_box')) {
  815. timebox = timeboxparent.children().eq(0);
  816. timeboxTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
  817. parentHeight = timeboxparent[0].clientHeight;
  818. height = timebox[0].offsetHeight;
  819. scrollbar = $('<div class="xdsoft_scrollbar"></div>');
  820. scroller = $('<div class="xdsoft_scroller"></div>');
  821. scrollbar.append(scroller);
  822. timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
  823. calcOffset = function calcOffset(event) {
  824. var offset = pointerEventToXY(event).y - startY + startTopScroll;
  825. if (offset < 0) {
  826. offset = 0;
  827. }
  828. if (offset + scroller[0].offsetHeight > h1) {
  829. offset = h1 - scroller[0].offsetHeight;
  830. }
  831. timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
  832. };
  833. scroller
  834. .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
  835. if (!parentHeight) {
  836. timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
  837. }
  838. startY = pointerEventToXY(event).y;
  839. startTopScroll = parseInt(scroller.css('marginTop'), 10);
  840. h1 = scrollbar[0].offsetHeight;
  841. if (event.type === 'mousedown' || event.type === 'touchstart') {
  842. if (options.ownerDocument) {
  843. $(options.ownerDocument.body).addClass('xdsoft_noselect');
  844. }
  845. $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
  846. $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
  847. .off('mousemove.xdsoft_scroller', calcOffset)
  848. .removeClass('xdsoft_noselect');
  849. });
  850. $(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
  851. } else {
  852. touchStart = true;
  853. event.stopPropagation();
  854. event.preventDefault();
  855. }
  856. })
  857. .on('touchmove', function (event) {
  858. if (touchStart) {
  859. event.preventDefault();
  860. calcOffset(event);
  861. }
  862. })
  863. .on('touchend touchcancel', function () {
  864. touchStart = false;
  865. startTopScroll = 0;
  866. });
  867. timeboxparent
  868. .on('scroll_element.xdsoft_scroller', function (event, percentage) {
  869. if (!parentHeight) {
  870. timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
  871. }
  872. percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
  873. timeboxTop = parseFloat(Math.abs((timebox[0].offsetHeight - parentHeight) * percentage).toFixed(4));
  874. scroller.css('marginTop', maximumOffset * percentage);
  875. timebox.css('marginTop', -timeboxTop);
  876. })
  877. .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
  878. var percent, sh;
  879. parentHeight = timeboxparent[0].clientHeight;
  880. height = timebox[0].offsetHeight;
  881. percent = parentHeight / height;
  882. sh = percent * scrollbar[0].offsetHeight;
  883. if (percent > 1) {
  884. scroller.hide();
  885. } else {
  886. scroller.show();
  887. scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
  888. maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
  889. if (noTriggerScroll !== true) {
  890. timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || timeboxTop / (height - parentHeight)]);
  891. }
  892. }
  893. });
  894. timeboxparent.on('mousewheel', function (event) {
  895. var deltaY = getWheelDelta(event.originalEvent);
  896. var top = Math.max(0, timeboxTop - deltaY);
  897. timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
  898. event.stopPropagation();
  899. return false;
  900. });
  901. timeboxparent.on('touchstart', function (event) {
  902. start = pointerEventToXY(event);
  903. startTop = timeboxTop;
  904. });
  905. timeboxparent.on('touchmove', function (event) {
  906. if (start) {
  907. event.preventDefault();
  908. var coord = pointerEventToXY(event);
  909. timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
  910. }
  911. });
  912. timeboxparent.on('touchend touchcancel', function () {
  913. start = false;
  914. startTop = 0;
  915. });
  916. }
  917. timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
  918. });
  919. };
  920. $.fn.datetimepicker = function (opt, opt2) {
  921. var ee = $(this);
  922. var result = this,
  923. KEY0 = 48,
  924. KEY9 = 57,
  925. _KEY0 = 96,
  926. _KEY9 = 105,
  927. CTRLKEY = 17,
  928. CMDKEY = 91,
  929. DEL = 46,
  930. ENTER = 13,
  931. ESC = 27,
  932. BACKSPACE = 8,
  933. ARROWLEFT = 37,
  934. ARROWUP = 38,
  935. ARROWRIGHT = 39,
  936. ARROWDOWN = 40,
  937. TAB = 9,
  938. F5 = 116,
  939. AKEY = 65,
  940. CKEY = 67,
  941. VKEY = 86,
  942. ZKEY = 90,
  943. YKEY = 89,
  944. ctrlDown = false,
  945. cmdDown = false,
  946. options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
  947. lazyInitTimer = 0,
  948. createDateTimePicker,
  949. destroyDateTimePicker,
  950. lazyInit = function (input) {
  951. input
  952. .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
  953. if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
  954. return;
  955. }
  956. clearTimeout(lazyInitTimer);
  957. lazyInitTimer = setTimeout(function () {
  958. if (!input.data('xdsoft_datetimepicker')) {
  959. createDateTimePicker(input);
  960. }
  961. input
  962. .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
  963. .trigger('open.xdsoft');
  964. }, 100);
  965. });
  966. };
  967. createDateTimePicker = function (input) {
  968. var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
  969. xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
  970. datepicker = $('<div class="xdsoft_datepicker active"></div>'),
  971. month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
  972. '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
  973. '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
  974. '<button type="button" class="xdsoft_next"></button></div>'),
  975. calendar = $('<div class="xdsoft_calendar"></div>'),
  976. 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>'),
  977. timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
  978. timebox = $('<div class="xdsoft_time_variant"></div>'),
  979. applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
  980. monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
  981. yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
  982. triggerAfterOpen = false,
  983. XDSoft_datetime,
  984. xchangeTimer,
  985. timerclick,
  986. current_time_index,
  987. setPos,
  988. timer = 0,
  989. _xdsoft_datetime,
  990. forEachAncestorOf;
  991. if (options.id) {
  992. datetimepicker.attr('id', options.id);
  993. }
  994. if (options.style) {
  995. datetimepicker.attr('style', options.style);
  996. }
  997. if (options.weeks) {
  998. datetimepicker.addClass('xdsoft_showweeks');
  999. }
  1000. if (options.rtl) {
  1001. datetimepicker.addClass('xdsoft_rtl');
  1002. }
  1003. datetimepicker.addClass('xdsoft_' + options.theme);
  1004. datetimepicker.addClass(options.className);
  1005. month_picker
  1006. .find('.xdsoft_month span')
  1007. .after(monthselect);
  1008. month_picker
  1009. .find('.xdsoft_year span')
  1010. .after(yearselect);
  1011. month_picker
  1012. .find('.xdsoft_month,.xdsoft_year')
  1013. .on('touchstart mousedown.xdsoft', function (event) {
  1014. var select = $(this).find('.xdsoft_select').eq(0),
  1015. val = 0,
  1016. top = 0,
  1017. visible = select.is(':visible'),
  1018. items,
  1019. i;
  1020. month_picker
  1021. .find('.xdsoft_select')
  1022. .hide();
  1023. if (_xdsoft_datetime.currentTime) {
  1024. val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
  1025. }
  1026. select[visible ? 'hide' : 'show']();
  1027. for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
  1028. if (items.eq(i).data('value') === val) {
  1029. break;
  1030. } else {
  1031. top += items[0].offsetHeight;
  1032. }
  1033. }
  1034. select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
  1035. event.stopPropagation();
  1036. return false;
  1037. });
  1038. var handleTouchMoved = function (event) {
  1039. var evt = event.originalEvent;
  1040. var touchPosition = evt.touches ? evt.touches[0] : evt;
  1041. this.touchStartPosition = this.touchStartPosition || touchPosition;
  1042. var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX);
  1043. var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY);
  1044. var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement);
  1045. if(distance > options.touchMovedThreshold) {
  1046. this.touchMoved = true;
  1047. }
  1048. }
  1049. month_picker
  1050. .find('.xdsoft_select')
  1051. .xdsoftScroller(options)
  1052. .on('touchstart mousedown.xdsoft', function (event) {
  1053. var evt = event.originalEvent;
  1054. this.touchMoved = false;
  1055. this.touchStartPosition = evt.touches ? evt.touches[0] : evt;
  1056. event.stopPropagation();
  1057. event.preventDefault();
  1058. })
  1059. .on('touchmove', '.xdsoft_option', handleTouchMoved)
  1060. .on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
  1061. if (!this.touchMoved) {
  1062. if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
  1063. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1064. }
  1065. var year = _xdsoft_datetime.currentTime.getFullYear();
  1066. if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
  1067. _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
  1068. }
  1069. $(this).parent().parent().hide();
  1070. datetimepicker.trigger('xchange.xdsoft');
  1071. if (options.onChangeMonth && typeof options.onChangeMonth === 'function') {
  1072. options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1073. }
  1074. if (year !== _xdsoft_datetime.currentTime.getFullYear() && typeof options.onChangeYear === 'function') {
  1075. options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1076. }
  1077. }
  1078. });
  1079. datetimepicker.getValue = function () {
  1080. return _xdsoft_datetime.getCurrentTime();
  1081. };
  1082. datetimepicker.setOptions = function (_options) {
  1083. var highlightedDates = {};
  1084. options = $.extend(true, {}, options, _options);
  1085. if (_options.allowTimes && Array.isArray(_options.allowTimes) && _options.allowTimes.length) {
  1086. options.allowTimes = $.extend(true, [], _options.allowTimes);
  1087. }
  1088. if (_options.weekends && Array.isArray(_options.weekends) && _options.weekends.length) {
  1089. options.weekends = $.extend(true, [], _options.weekends);
  1090. }
  1091. if (_options.allowDates && Array.isArray(_options.allowDates) && _options.allowDates.length) {
  1092. options.allowDates = $.extend(true, [], _options.allowDates);
  1093. }
  1094. if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
  1095. options.allowDateRe = new RegExp(_options.allowDateRe);
  1096. }
  1097. if (_options.highlightedDates && Array.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
  1098. $.each(_options.highlightedDates, function (index, value) {
  1099. var splitData = $.map(value.split(','), $.trim),
  1100. exDesc,
  1101. hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
  1102. keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
  1103. if (highlightedDates[keyDate] !== undefined) {
  1104. exDesc = highlightedDates[keyDate].desc;
  1105. if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
  1106. highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
  1107. }
  1108. } else {
  1109. highlightedDates[keyDate] = hDate;
  1110. }
  1111. });
  1112. options.highlightedDates = $.extend(true, [], highlightedDates);
  1113. }
  1114. if (_options.highlightedPeriods && Array.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
  1115. highlightedDates = $.extend(true, [], options.highlightedDates);
  1116. $.each(_options.highlightedPeriods, function (index, value) {
  1117. var dateTest, // start date
  1118. dateEnd,
  1119. desc,
  1120. hDate,
  1121. keyDate,
  1122. exDesc,
  1123. style;
  1124. if (Array.isArray(value)) {
  1125. dateTest = value[0];
  1126. dateEnd = value[1];
  1127. desc = value[2];
  1128. style = value[3];
  1129. }
  1130. else {
  1131. var splitData = $.map(value.split(','), $.trim);
  1132. dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
  1133. dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
  1134. desc = splitData[2];
  1135. style = splitData[3];
  1136. }
  1137. while (dateTest <= dateEnd) {
  1138. hDate = new HighlightedDate(dateTest, desc, style);
  1139. keyDate = dateHelper.formatDate(dateTest, options.formatDate);
  1140. dateTest.setDate(dateTest.getDate() + 1);
  1141. if (highlightedDates[keyDate] !== undefined) {
  1142. exDesc = highlightedDates[keyDate].desc;
  1143. if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
  1144. highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
  1145. }
  1146. } else {
  1147. highlightedDates[keyDate] = hDate;
  1148. }
  1149. }
  1150. });
  1151. options.highlightedDates = $.extend(true, [], highlightedDates);
  1152. }
  1153. if (_options.disabledDates && Array.isArray(_options.disabledDates) && _options.disabledDates.length) {
  1154. options.disabledDates = $.extend(true, [], _options.disabledDates);
  1155. }
  1156. if (_options.disabledWeekDays && Array.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
  1157. options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
  1158. }
  1159. if ((options.open || options.opened) && (!options.inline)) {
  1160. input.trigger('open.xdsoft');
  1161. }
  1162. if (options.inline) {
  1163. triggerAfterOpen = true;
  1164. datetimepicker.addClass('xdsoft_inline');
  1165. input.after(datetimepicker).hide();
  1166. }
  1167. if (options.inverseButton) {
  1168. options.next = 'xdsoft_prev';
  1169. options.prev = 'xdsoft_next';
  1170. }
  1171. if (options.datepicker) {
  1172. datepicker.addClass('active');
  1173. } else {
  1174. datepicker.removeClass('active');
  1175. }
  1176. if (options.timepicker) {
  1177. timepicker.addClass('active');
  1178. } else {
  1179. timepicker.removeClass('active');
  1180. }
  1181. if (options.value) {
  1182. _xdsoft_datetime.setCurrentTime(options.value);
  1183. if (input && input.val) {
  1184. input.val(_xdsoft_datetime.str);
  1185. }
  1186. }
  1187. if (isNaN(options.dayOfWeekStart)) {
  1188. options.dayOfWeekStart = 0;
  1189. } else {
  1190. options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
  1191. }
  1192. if (!options.timepickerScrollbar) {
  1193. timeboxparent.xdsoftScroller(options, 'hide');
  1194. }
  1195. if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
  1196. options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
  1197. }
  1198. if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
  1199. options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
  1200. }
  1201. if (options.minDateTime && /^\+(.*)$/.test(options.minDateTime)) {
  1202. options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate);
  1203. }
  1204. if (options.maxDateTime && /^\+(.*)$/.test(options.maxDateTime)) {
  1205. options.maxDateTime = _xdsoft_datetime.strToDateTime(options.maxDateTime).dateFormat(options.formatDate);
  1206. }
  1207. applyButton.toggle(options.showApplyButton);
  1208. month_picker
  1209. .find('.xdsoft_today_button')
  1210. .css('visibility', !options.todayButton ? 'hidden' : 'visible');
  1211. month_picker
  1212. .find('.' + options.prev)
  1213. .css('visibility', !options.prevButton ? 'hidden' : 'visible');
  1214. month_picker
  1215. .find('.' + options.next)
  1216. .css('visibility', !options.nextButton ? 'hidden' : 'visible');
  1217. setMask(options);
  1218. if (options.validateOnBlur) {
  1219. input
  1220. .off('blur.xdsoft')
  1221. .on('blur.xdsoft', function () {
  1222. if (options.allowBlank && (!$(this).val().trim().length ||
  1223. (typeof options.mask === "string" && $(this).val().trim() === options.mask.replace(/[0-9]/g, '_')))) {
  1224. $(this).val(null);
  1225. datetimepicker.data('xdsoft_datetime').empty();
  1226. } else {
  1227. var d = dateHelper.parseDate($(this).val(), options.format);
  1228. if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
  1229. $(this).val(dateHelper.formatDate(d, options.format));
  1230. } else {
  1231. var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
  1232. splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
  1233. // parse the numbers as 0312 => 03:12
  1234. if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
  1235. $(this).val([splittedHours, splittedMinutes].map(function (item) {
  1236. return item > 9 ? item : '0' + item;
  1237. }).join(':'));
  1238. } else {
  1239. $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
  1240. }
  1241. }
  1242. datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
  1243. }
  1244. datetimepicker.trigger('changedatetime.xdsoft');
  1245. datetimepicker.trigger('close.xdsoft');
  1246. });
  1247. }
  1248. options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
  1249. datetimepicker
  1250. .trigger('xchange.xdsoft')
  1251. .trigger('afterOpen.xdsoft');
  1252. };
  1253. datetimepicker
  1254. .data('options', options)
  1255. .on('touchstart mousedown.xdsoft', function (event) {
  1256. event.stopPropagation();
  1257. event.preventDefault();
  1258. yearselect.hide();
  1259. monthselect.hide();
  1260. return false;
  1261. });
  1262. //scroll_element = timepicker.find('.xdsoft_time_box');
  1263. timeboxparent.append(timebox);
  1264. timeboxparent.xdsoftScroller(options);
  1265. datetimepicker.on('afterOpen.xdsoft', function () {
  1266. timeboxparent.xdsoftScroller(options);
  1267. });
  1268. datetimepicker
  1269. .append(datepicker)
  1270. .append(timepicker);
  1271. if (options.withoutCopyright !== true) {
  1272. datetimepicker
  1273. .append(xdsoft_copyright);
  1274. }
  1275. datepicker
  1276. .append(month_picker)
  1277. .append(calendar)
  1278. .append(applyButton);
  1279. if (options.insideParent) {
  1280. $(input).parent().append(datetimepicker);
  1281. } else {
  1282. $(options.parentID).append(datetimepicker);
  1283. }
  1284. XDSoft_datetime = function () {
  1285. var _this = this;
  1286. _this.now = function (norecursion) {
  1287. var d = new Date(),
  1288. date,
  1289. time;
  1290. if (!norecursion && options.defaultDate) {
  1291. date = _this.strToDateTime(options.defaultDate);
  1292. d.setFullYear(date.getFullYear());
  1293. d.setMonth(date.getMonth());
  1294. d.setDate(date.getDate());
  1295. }
  1296. d.setFullYear(d.getFullYear());
  1297. if (!norecursion && options.defaultTime) {
  1298. time = _this.strtotime(options.defaultTime);
  1299. d.setHours(time.getHours());
  1300. d.setMinutes(time.getMinutes());
  1301. d.setSeconds(time.getSeconds());
  1302. d.setMilliseconds(time.getMilliseconds());
  1303. }
  1304. return d;
  1305. };
  1306. _this.isValidDate = function (d) {
  1307. if (Object.prototype.toString.call(d) !== "[object Date]") {
  1308. return false;
  1309. }
  1310. return !isNaN(d.getTime());
  1311. };
  1312. _this.setCurrentTime = function (dTime, requireValidDate) {
  1313. if (typeof dTime === 'string') {
  1314. _this.currentTime = _this.strToDateTime(dTime);
  1315. }
  1316. else if (_this.isValidDate(dTime)) {
  1317. _this.currentTime = dTime;
  1318. }
  1319. else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) {
  1320. _this.currentTime = null;
  1321. }
  1322. else {
  1323. _this.currentTime = _this.now();
  1324. }
  1325. datetimepicker.trigger('xchange.xdsoft');
  1326. };
  1327. _this.empty = function () {
  1328. _this.currentTime = null;
  1329. };
  1330. _this.getCurrentTime = function () {
  1331. return _this.currentTime;
  1332. };
  1333. _this.nextMonth = function () {
  1334. if (_this.currentTime === undefined || _this.currentTime === null) {
  1335. _this.currentTime = _this.now();
  1336. }
  1337. var month = _this.currentTime.getMonth() + 1,
  1338. year;
  1339. if (month === 12) {
  1340. _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
  1341. month = 0;
  1342. }
  1343. year = _this.currentTime.getFullYear();
  1344. _this.currentTime.setDate(
  1345. Math.min(
  1346. new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
  1347. _this.currentTime.getDate()
  1348. )
  1349. );
  1350. _this.currentTime.setMonth(month);
  1351. if (options.onChangeMonth && typeof options.onChangeMonth === 'function') {
  1352. options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1353. }
  1354. if (year !== _this.currentTime.getFullYear() && typeof options.onChangeYear === 'function') {
  1355. options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1356. }
  1357. datetimepicker.trigger('xchange.xdsoft');
  1358. return month;
  1359. };
  1360. _this.prevMonth = function () {
  1361. if (_this.currentTime === undefined || _this.currentTime === null) {
  1362. _this.currentTime = _this.now();
  1363. }
  1364. var month = _this.currentTime.getMonth() - 1;
  1365. if (month === -1) {
  1366. _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
  1367. month = 11;
  1368. }
  1369. _this.currentTime.setDate(
  1370. Math.min(
  1371. new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
  1372. _this.currentTime.getDate()
  1373. )
  1374. );
  1375. _this.currentTime.setMonth(month);
  1376. if (options.onChangeMonth && typeof options.onChangeMonth === 'function') {
  1377. options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1378. }
  1379. datetimepicker.trigger('xchange.xdsoft');
  1380. return month;
  1381. };
  1382. _this.getWeekOfYear = function (datetime) {
  1383. if (options.onGetWeekOfYear && typeof options.onGetWeekOfYear === 'function') {
  1384. var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
  1385. if (typeof week !== 'undefined') {
  1386. return week;
  1387. }
  1388. }
  1389. var onejan = new Date(datetime.getFullYear(), 0, 1);
  1390. //First week of the year is th one with the first Thursday according to ISO8601
  1391. if (onejan.getDay() !== 4) {
  1392. onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
  1393. }
  1394. return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
  1395. };
  1396. _this.strToDateTime = function (sDateTime) {
  1397. var tmpDate = [], timeOffset, currentTime;
  1398. if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
  1399. return sDateTime;
  1400. }
  1401. tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime);
  1402. if (tmpDate) {
  1403. tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
  1404. }
  1405. if (tmpDate && tmpDate[2]) {
  1406. timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
  1407. currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
  1408. } else {
  1409. currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
  1410. }
  1411. if (!_this.isValidDate(currentTime)) {
  1412. currentTime = _this.now();
  1413. }
  1414. return currentTime;
  1415. };
  1416. _this.strToDate = function (sDate) {
  1417. if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
  1418. return sDate;
  1419. }
  1420. var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
  1421. if (!_this.isValidDate(currentTime)) {
  1422. currentTime = _this.now(true);
  1423. }
  1424. return currentTime;
  1425. };
  1426. _this.strtotime = function (sTime) {
  1427. if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
  1428. return sTime;
  1429. }
  1430. var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
  1431. if (!_this.isValidDate(currentTime)) {
  1432. currentTime = _this.now(true);
  1433. }
  1434. return currentTime;
  1435. };
  1436. _this.str = function () {
  1437. var format = options.format;
  1438. if (options.yearOffset) {
  1439. format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset);
  1440. format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4));
  1441. }
  1442. return dateHelper.formatDate(_this.currentTime, format);
  1443. };
  1444. _this.currentTime = this.now();
  1445. };
  1446. _xdsoft_datetime = new XDSoft_datetime();
  1447. applyButton.on('touchend click', function (e) {//pathbrite
  1448. e.preventDefault();
  1449. datetimepicker.data('changed', true);
  1450. _xdsoft_datetime.setCurrentTime(getCurrentValue());
  1451. input.val(_xdsoft_datetime.str());
  1452. datetimepicker.trigger('close.xdsoft');
  1453. });
  1454. month_picker
  1455. .find('.xdsoft_today_button')
  1456. .on('touchend mousedown.xdsoft', function () {
  1457. datetimepicker.data('changed', true);
  1458. _xdsoft_datetime.setCurrentTime(0, true);
  1459. datetimepicker.trigger('afterOpen.xdsoft');
  1460. }).on('dblclick.xdsoft', function () {
  1461. var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
  1462. currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
  1463. minDate = _xdsoft_datetime.strToDate(options.minDate);
  1464. minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
  1465. if (currentDate < minDate) {
  1466. return;
  1467. }
  1468. maxDate = _xdsoft_datetime.strToDate(options.maxDate);
  1469. maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
  1470. if (currentDate > maxDate) {
  1471. return;
  1472. }
  1473. input.val(_xdsoft_datetime.str());
  1474. input.trigger('change');
  1475. datetimepicker.trigger('close.xdsoft');
  1476. });
  1477. month_picker
  1478. .find('.xdsoft_prev,.xdsoft_next')
  1479. .on('touchend mousedown.xdsoft', function () {
  1480. var $this = $(this),
  1481. timer = 0,
  1482. stop = false;
  1483. (function arguments_callee1(v) {
  1484. if ($this.hasClass(options.next)) {
  1485. _xdsoft_datetime.nextMonth();
  1486. } else if ($this.hasClass(options.prev)) {
  1487. _xdsoft_datetime.prevMonth();
  1488. }
  1489. if (options.monthChangeSpinner) {
  1490. if (!stop) {
  1491. timer = setTimeout(arguments_callee1, v || 100);
  1492. }
  1493. }
  1494. }(500));
  1495. $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
  1496. clearTimeout(timer);
  1497. stop = true;
  1498. $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
  1499. });
  1500. });
  1501. timepicker
  1502. .find('.xdsoft_prev,.xdsoft_next')
  1503. .on('touchend mousedown.xdsoft', function () {
  1504. var $this = $(this),
  1505. timer = 0,
  1506. stop = false,
  1507. period = 110;
  1508. (function arguments_callee4(v) {
  1509. var pheight = timeboxparent[0].clientHeight,
  1510. height = timebox[0].offsetHeight,
  1511. top = Math.abs(parseInt(timebox.css('marginTop'), 10));
  1512. /**
  1513. * Fixes a bug which happens if:
  1514. * top is < the timeHeightInTimePicker, it will cause the up arrow to stop working
  1515. * same for the down arrow if it's not exactly on the pixel
  1516. */
  1517. if (top < options.timeHeightInTimePicker) {
  1518. top = options.timeHeightInTimePicker;
  1519. } else if ($this.hasClass(options.next) && (height - pheight) < top) {
  1520. timebox.css('marginTop', '-' + height + 'px');
  1521. }
  1522. if ($this.hasClass(options.next) && (height - pheight) > top) {
  1523. timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
  1524. } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
  1525. timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
  1526. }
  1527. /**
  1528. * Fixed bug:
  1529. * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
  1530. * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
  1531. * would cause a bug when you use jquery.css method.
  1532. * Let's say: * { transition: all .5s ease; }
  1533. * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
  1534. * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
  1535. * next/prev button.
  1536. *
  1537. * What we should do:
  1538. * Replace timebox.css('marginTop') with timebox[0].style.marginTop.
  1539. */
  1540. timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
  1541. period = (period > 10) ? 10 : period - 10;
  1542. if (!stop) {
  1543. timer = setTimeout(arguments_callee4, v || period);
  1544. }
  1545. }(500));
  1546. $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
  1547. clearTimeout(timer);
  1548. stop = true;
  1549. $([options.ownerDocument.body, options.contentWindow])
  1550. .off('touchend mouseup.xdsoft', arguments_callee5);
  1551. });
  1552. });
  1553. xchangeTimer = 0;
  1554. // base handler - generating a calendar and timepicker
  1555. datetimepicker
  1556. .on('xchange.xdsoft', function (event) {
  1557. clearTimeout(xchangeTimer);
  1558. xchangeTimer = setTimeout(function () {
  1559. if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null || isNaN(_xdsoft_datetime.currentTime.getTime())) {
  1560. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1561. }
  1562. var table = '',
  1563. start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
  1564. i = 0,
  1565. j,
  1566. today = _xdsoft_datetime.now(),
  1567. maxDate = false,
  1568. minDate = false,
  1569. minDateTime = false,
  1570. maxDateTime = false,
  1571. hDate,
  1572. day,
  1573. d,
  1574. y,
  1575. m,
  1576. w,
  1577. classes = [],
  1578. customDateSettings,
  1579. newRow = true,
  1580. time = '',
  1581. h,
  1582. line_time,
  1583. description;
  1584. while (start.getDay() !== options.dayOfWeekStart) {
  1585. start.setDate(start.getDate() - 1);
  1586. }
  1587. table += '<table><thead><tr>';
  1588. if (options.weeks) {
  1589. table += '<th></th>';
  1590. }
  1591. for (j = 0; j < 7; j += 1) {
  1592. table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
  1593. }
  1594. table += '</tr></thead>';
  1595. table += '<tbody>';
  1596. if (options.maxDate !== false) {
  1597. maxDate = _xdsoft_datetime.strToDate(options.maxDate);
  1598. maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
  1599. }
  1600. if (options.minDate !== false) {
  1601. minDate = _xdsoft_datetime.strToDate(options.minDate);
  1602. minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
  1603. }
  1604. if (options.minDateTime !== false) {
  1605. minDateTime = _xdsoft_datetime.strToDate(options.minDateTime);
  1606. minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds());
  1607. }
  1608. if (options.maxDateTime !== false) {
  1609. maxDateTime = _xdsoft_datetime.strToDate(options.maxDateTime);
  1610. maxDateTime = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), maxDateTime.getHours(), maxDateTime.getMinutes(), maxDateTime.getSeconds());
  1611. }
  1612. var maxDateTimeDay;
  1613. if (maxDateTime !== false) {
  1614. maxDateTimeDay = ((maxDateTime.getFullYear() * 12) + maxDateTime.getMonth()) * 31 + maxDateTime.getDate();
  1615. }
  1616. while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
  1617. classes = [];
  1618. i += 1;
  1619. day = start.getDay();
  1620. d = start.getDate();
  1621. y = start.getFullYear();
  1622. m = start.getMonth();
  1623. w = _xdsoft_datetime.getWeekOfYear(start);
  1624. description = '';
  1625. classes.push('xdsoft_date');
  1626. if (options.beforeShowDay && typeof options.beforeShowDay.call === 'function') {
  1627. customDateSettings = options.beforeShowDay.call(datetimepicker, start);
  1628. } else {
  1629. customDateSettings = null;
  1630. }
  1631. if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
  1632. if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
  1633. classes.push('xdsoft_disabled');
  1634. }
  1635. }
  1636. if(options.allowDates && options.allowDates.length>0){
  1637. if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
  1638. classes.push('xdsoft_disabled');
  1639. }
  1640. }
  1641. var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate();
  1642. if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime) || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) {
  1643. classes.push('xdsoft_disabled');
  1644. }
  1645. if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
  1646. classes.push('xdsoft_disabled');
  1647. }
  1648. if (options.disabledWeekDays.indexOf(day) !== -1) {
  1649. classes.push('xdsoft_disabled');
  1650. }
  1651. if (input.is('[disabled]')) {
  1652. classes.push('xdsoft_disabled');
  1653. }
  1654. if (customDateSettings && customDateSettings[1] !== "") {
  1655. classes.push(customDateSettings[1]);
  1656. }
  1657. if (_xdsoft_datetime.currentTime.getMonth() !== m) {
  1658. classes.push('xdsoft_other_month');
  1659. }
  1660. if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
  1661. classes.push('xdsoft_current');
  1662. }
  1663. if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
  1664. classes.push('xdsoft_today');
  1665. }
  1666. if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
  1667. classes.push('xdsoft_weekend');
  1668. }
  1669. if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
  1670. hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
  1671. classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
  1672. description = hDate.desc === undefined ? '' : hDate.desc;
  1673. }
  1674. if (options.beforeShowDay && typeof options.beforeShowDay === 'function') {
  1675. classes.push(options.beforeShowDay(start));
  1676. }
  1677. if (newRow) {
  1678. table += '<tr>';
  1679. newRow = false;
  1680. if (options.weeks) {
  1681. table += '<th>' + w + '</th>';
  1682. }
  1683. }
  1684. table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
  1685. '<div>' + d + '</div>' +
  1686. '</td>';
  1687. if (start.getDay() === options.dayOfWeekStartPrev) {
  1688. table += '</tr>';
  1689. newRow = true;
  1690. }
  1691. start.setDate(d + 1);
  1692. }
  1693. table += '</tbody></table>';
  1694. calendar.html(table);
  1695. month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
  1696. month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset);
  1697. // generate timebox
  1698. time = '';
  1699. h = '';
  1700. m = '';
  1701. var minTimeMinutesOfDay = 0;
  1702. if (options.minTime !== false) {
  1703. var t = _xdsoft_datetime.strtotime(options.minTime);
  1704. minTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
  1705. }
  1706. var maxTimeMinutesOfDay = 24 * 60;
  1707. if (options.maxTime !== false) {
  1708. var t = _xdsoft_datetime.strtotime(options.maxTime);
  1709. maxTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
  1710. }
  1711. if (options.minDateTime !== false) {
  1712. var t = _xdsoft_datetime.strToDateTime(options.minDateTime);
  1713. var currentDayIsMinDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
  1714. if (currentDayIsMinDateTimeDay) {
  1715. var m = 60 * t.getHours() + t.getMinutes();
  1716. if (m > minTimeMinutesOfDay) minTimeMinutesOfDay = m;
  1717. }
  1718. }
  1719. if (options.maxDateTime !== false) {
  1720. var t = _xdsoft_datetime.strToDateTime(options.maxDateTime);
  1721. var currentDayIsMaxDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
  1722. if (currentDayIsMaxDateTimeDay) {
  1723. var m = 60 * t.getHours() + t.getMinutes();
  1724. if (m < maxTimeMinutesOfDay) maxTimeMinutesOfDay = m;
  1725. }
  1726. }
  1727. line_time = function line_time(h, m) {
  1728. var now = _xdsoft_datetime.now(), current_time,
  1729. isALlowTimesInit = options.allowTimes && Array.isArray(options.allowTimes) && options.allowTimes.length;
  1730. now.setHours(h);
  1731. h = parseInt(now.getHours(), 10);
  1732. now.setMinutes(m);
  1733. m = parseInt(now.getMinutes(), 10);
  1734. classes = [];
  1735. var currentMinutesOfDay = 60 * h + m;
  1736. if (input.is('[disabled]') || (currentMinutesOfDay >= maxTimeMinutesOfDay) || (currentMinutesOfDay < minTimeMinutesOfDay)) {
  1737. classes.push('xdsoft_disabled');
  1738. }
  1739. current_time = new Date(_xdsoft_datetime.currentTime);
  1740. current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
  1741. if (!isALlowTimesInit) {
  1742. current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
  1743. }
  1744. if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
  1745. if (options.defaultSelect || datetimepicker.data('changed')) {
  1746. classes.push('xdsoft_current');
  1747. } else if (options.initTime) {
  1748. classes.push('xdsoft_init_time');
  1749. }
  1750. }
  1751. if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
  1752. classes.push('xdsoft_today');
  1753. }
  1754. time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
  1755. };
  1756. if (!options.allowTimes || !Array.isArray(options.allowTimes) || !options.allowTimes.length) {
  1757. for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
  1758. for (j = 0; j < 60; j += options.step) {
  1759. var currentMinutesOfDay = i * 60 + j;
  1760. if (currentMinutesOfDay < minTimeMinutesOfDay) continue;
  1761. if (currentMinutesOfDay >= maxTimeMinutesOfDay) continue;
  1762. h = (i < 10 ? '0' : '') + i;
  1763. m = (j < 10 ? '0' : '') + j;
  1764. line_time(h, m);
  1765. }
  1766. }
  1767. } else {
  1768. for (i = 0; i < options.allowTimes.length; i += 1) {
  1769. h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
  1770. m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
  1771. line_time(h, m);
  1772. }
  1773. }
  1774. timebox.html(time);
  1775. opt = '';
  1776. for (i = parseInt(options.yearStart, 10); i <= parseInt(options.yearEnd, 10); i += 1) {
  1777. opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + (i + options.yearOffset) + '</div>';
  1778. }
  1779. yearselect.children().eq(0)
  1780. .html(opt);
  1781. for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
  1782. opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
  1783. }
  1784. monthselect.children().eq(0).html(opt);
  1785. $(datetimepicker)
  1786. .trigger('generate.xdsoft');
  1787. }, 10);
  1788. event.stopPropagation();
  1789. })
  1790. .on('afterOpen.xdsoft', function () {
  1791. if (options.timepicker) {
  1792. var classType, pheight, height, top;
  1793. if (timebox.find('.xdsoft_current').length) {
  1794. classType = '.xdsoft_current';
  1795. } else if (timebox.find('.xdsoft_init_time').length) {
  1796. classType = '.xdsoft_init_time';
  1797. }
  1798. if (classType) {
  1799. pheight = timeboxparent[0].clientHeight;
  1800. height = timebox[0].offsetHeight;
  1801. top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
  1802. if ((height - pheight) < top) {
  1803. top = height - pheight;
  1804. }
  1805. timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
  1806. } else {
  1807. timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
  1808. }
  1809. }
  1810. });
  1811. timerclick = 0;
  1812. calendar
  1813. .on('touchend click.xdsoft', 'td', function (xdevent) {
  1814. xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
  1815. timerclick += 1;
  1816. var $this = $(this),
  1817. currentTime = _xdsoft_datetime.currentTime;
  1818. if (currentTime === undefined || currentTime === null) {
  1819. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1820. currentTime = _xdsoft_datetime.currentTime;
  1821. }
  1822. if ($this.hasClass('xdsoft_disabled')) {
  1823. return false;
  1824. }
  1825. currentTime.setDate(1);
  1826. currentTime.setFullYear($this.data('year'));
  1827. currentTime.setMonth($this.data('month'));
  1828. currentTime.setDate($this.data('date'));
  1829. datetimepicker.trigger('select.xdsoft', [currentTime]);
  1830. input.val(_xdsoft_datetime.str());
  1831. if (options.onSelectDate && typeof options.onSelectDate === 'function') {
  1832. options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
  1833. }
  1834. datetimepicker.data('changed', true);
  1835. datetimepicker.trigger('xchange.xdsoft');
  1836. datetimepicker.trigger('changedatetime.xdsoft');
  1837. if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
  1838. datetimepicker.trigger('close.xdsoft');
  1839. }
  1840. setTimeout(function () {
  1841. timerclick = 0;
  1842. }, 200);
  1843. });
  1844. timebox
  1845. .on('touchstart', 'div', function (xdevent) {
  1846. this.touchMoved = false;
  1847. })
  1848. .on('touchmove', 'div', handleTouchMoved)
  1849. .on('touchend click.xdsoft', 'div', function (xdevent) {
  1850. if (!this.touchMoved) {
  1851. xdevent.stopPropagation();
  1852. var $this = $(this),
  1853. currentTime = _xdsoft_datetime.currentTime;
  1854. if (currentTime === undefined || currentTime === null) {
  1855. _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
  1856. currentTime = _xdsoft_datetime.currentTime;
  1857. }
  1858. if ($this.hasClass('xdsoft_disabled')) {
  1859. return false;
  1860. }
  1861. currentTime.setHours($this.data('hour'));
  1862. currentTime.setMinutes($this.data('minute'));
  1863. datetimepicker.trigger('select.xdsoft', [currentTime]);
  1864. datetimepicker.data('input').val(_xdsoft_datetime.str());
  1865. if (options.onSelectTime && typeof options.onSelectTime === 'function') {
  1866. options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
  1867. }
  1868. datetimepicker.data('changed', true);
  1869. datetimepicker.trigger('xchange.xdsoft');
  1870. datetimepicker.trigger('changedatetime.xdsoft');
  1871. if (options.inline !== true && options.closeOnTimeSelect === true) {
  1872. datetimepicker.trigger('close.xdsoft');
  1873. }
  1874. }
  1875. });
  1876. datepicker
  1877. .on('mousewheel.xdsoft', function (event) {
  1878. if (!options.scrollMonth) {
  1879. return true;
  1880. }
  1881. if (event.deltaY < 0) {
  1882. _xdsoft_datetime.nextMonth();
  1883. } else {
  1884. _xdsoft_datetime.prevMonth();
  1885. }
  1886. return false;
  1887. });
  1888. input
  1889. .on('mousewheel.xdsoft', function (event) {
  1890. if (!options.scrollInput) {
  1891. return true;
  1892. }
  1893. if (!options.datepicker && options.timepicker) {
  1894. current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
  1895. if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
  1896. current_time_index += event.deltaY;
  1897. }
  1898. if (timebox.children().eq(current_time_index).length) {
  1899. timebox.children().eq(current_time_index).trigger('mousedown');
  1900. }
  1901. return false;
  1902. }
  1903. if (options.datepicker && !options.timepicker) {
  1904. datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
  1905. if (input.val) {
  1906. input.val(_xdsoft_datetime.str());
  1907. }
  1908. datetimepicker.trigger('changedatetime.xdsoft');
  1909. return false;
  1910. }
  1911. });
  1912. datetimepicker
  1913. .on('changedatetime.xdsoft', function (event) {
  1914. if (options.onChangeDateTime && typeof options.onChangeDateTime === 'function') {
  1915. var $input = datetimepicker.data('input');
  1916. options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
  1917. delete options.value;
  1918. $input.trigger('change');
  1919. }
  1920. })
  1921. .on('generate.xdsoft', function () {
  1922. if (options.onGenerate && typeof options.onGenerate === 'function') {
  1923. options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
  1924. }
  1925. if (triggerAfterOpen) {
  1926. datetimepicker.trigger('afterOpen.xdsoft');
  1927. triggerAfterOpen = false;
  1928. }
  1929. })
  1930. .on('click.xdsoft', function (xdevent) {
  1931. xdevent.stopPropagation();
  1932. });
  1933. current_time_index = 0;
  1934. /**
  1935. * Runs the callback for each of the specified node's ancestors.
  1936. *
  1937. * Return FALSE from the callback to stop ascending.
  1938. *
  1939. * @param {DOMNode} node
  1940. * @param {Function} callback
  1941. * @returns {undefined}
  1942. */
  1943. forEachAncestorOf = function (node, callback) {
  1944. do {
  1945. node = node.parentNode;
  1946. if (!node || callback(node) === false) {
  1947. break;
  1948. }
  1949. } while (node.nodeName !== 'HTML');
  1950. };
  1951. /**
  1952. * Sets the position of the picker.
  1953. *
  1954. * @returns {undefined}
  1955. */
  1956. setPos = function () {
  1957. var dateInputOffset,
  1958. dateInputElem,
  1959. verticalPosition,
  1960. left,
  1961. position,
  1962. datetimepickerElem,
  1963. dateInputHasFixedAncestor,
  1964. $dateInput,
  1965. windowWidth,
  1966. verticalAnchorEdge,
  1967. datetimepickerCss,
  1968. windowHeight,
  1969. windowScrollTop;
  1970. $dateInput = datetimepicker.data('input');
  1971. dateInputOffset = $dateInput.offset();
  1972. dateInputElem = $dateInput[0];
  1973. verticalAnchorEdge = 'top';
  1974. verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
  1975. left = dateInputOffset.left;
  1976. position = "absolute";
  1977. windowWidth = $(options.contentWindow).width();
  1978. windowHeight = $(options.contentWindow).height();
  1979. windowScrollTop = $(options.contentWindow).scrollTop();
  1980. if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
  1981. var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
  1982. left = left - diff;
  1983. }
  1984. if ($dateInput.parent().css('direction') === 'rtl') {
  1985. left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
  1986. }
  1987. if (options.fixed) {
  1988. verticalPosition -= windowScrollTop;
  1989. left -= $(options.contentWindow).scrollLeft();
  1990. position = "fixed";
  1991. } else {
  1992. dateInputHasFixedAncestor = false;
  1993. forEachAncestorOf(dateInputElem, function (ancestorNode) {
  1994. if (ancestorNode === null) {
  1995. return false;
  1996. }
  1997. if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
  1998. dateInputHasFixedAncestor = true;
  1999. return false;
  2000. }
  2001. });
  2002. if (dateInputHasFixedAncestor && !options.insideParent) {
  2003. position = 'fixed';
  2004. //If the picker won't fit entirely within the viewport then display it above the date input.
  2005. if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
  2006. verticalAnchorEdge = 'bottom';
  2007. verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
  2008. } else {
  2009. verticalPosition -= windowScrollTop;
  2010. }
  2011. } else {
  2012. if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) {
  2013. verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1;
  2014. }
  2015. }
  2016. if (verticalPosition < 0) {
  2017. verticalPosition = 0;
  2018. }
  2019. if (left + dateInputElem.offsetWidth > windowWidth) {
  2020. left = windowWidth - dateInputElem.offsetWidth;
  2021. }
  2022. }
  2023. datetimepickerElem = datetimepicker[0];
  2024. forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
  2025. var ancestorNodePosition;
  2026. ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
  2027. if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
  2028. left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
  2029. return false;
  2030. }
  2031. });
  2032. datetimepickerCss = {
  2033. position: position,
  2034. left: options.insideParent ? dateInputElem.offsetLeft : left,
  2035. top: '', //Initialize to prevent previous values interfering with new ones.
  2036. bottom: '' //Initialize to prevent previous values interfering with new ones.
  2037. };
  2038. if (options.insideParent) {
  2039. datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight;
  2040. } else {
  2041. datetimepickerCss[verticalAnchorEdge] = verticalPosition;
  2042. }
  2043. datetimepicker.css(datetimepickerCss);
  2044. };
  2045. datetimepicker
  2046. .on('open.xdsoft', function (event) {
  2047. var onShow = true;
  2048. if (options.onShow && typeof options.onShow === 'function') {
  2049. onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
  2050. }
  2051. if (onShow !== false) {
  2052. datetimepicker.show();
  2053. setPos();
  2054. $(options.contentWindow)
  2055. .off('resize.xdsoft', setPos)
  2056. .on('resize.xdsoft', setPos);
  2057. if (options.closeOnWithoutClick) {
  2058. $([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
  2059. datetimepicker.trigger('close.xdsoft');
  2060. $([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
  2061. });
  2062. }
  2063. }
  2064. })
  2065. .on('close.xdsoft', function (event) {
  2066. var onClose = true;
  2067. month_picker
  2068. .find('.xdsoft_month,.xdsoft_year')
  2069. .find('.xdsoft_select')
  2070. .hide();
  2071. if (options.onClose && typeof options.onClose === 'function') {
  2072. onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
  2073. }
  2074. if (onClose !== false && !options.opened && !options.inline) {
  2075. datetimepicker.hide();
  2076. }
  2077. event.stopPropagation();
  2078. })
  2079. .on('toggle.xdsoft', function () {
  2080. if (datetimepicker.is(':visible')) {
  2081. datetimepicker.trigger('close.xdsoft');
  2082. } else {
  2083. datetimepicker.trigger('open.xdsoft');
  2084. }
  2085. })
  2086. .data('input', input);
  2087. timer = 0;
  2088. datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
  2089. datetimepicker.setOptions(options);
  2090. function getCurrentValue() {
  2091. var ct = false, time;
  2092. if (options.startDate) {
  2093. ct = _xdsoft_datetime.strToDate(options.startDate);
  2094. } else {
  2095. ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
  2096. if (ct) {
  2097. ct = _xdsoft_datetime.strToDateTime(ct);
  2098. if (options.yearOffset) {
  2099. ct = new Date(ct.getFullYear() - options.yearOffset, ct.getMonth(), ct.getDate(), ct.getHours(), ct.getMinutes(), ct.getSeconds(), ct.getMilliseconds());
  2100. }
  2101. } else if (options.defaultDate) {
  2102. ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
  2103. if (options.defaultTime) {
  2104. time = _xdsoft_datetime.strtotime(options.defaultTime);
  2105. ct.setHours(time.getHours());
  2106. ct.setMinutes(time.getMinutes());
  2107. }
  2108. }
  2109. }
  2110. if (ct && _xdsoft_datetime.isValidDate(ct)) {
  2111. datetimepicker.data('changed', true);
  2112. } else {
  2113. ct = '';
  2114. }
  2115. return ct || 0;
  2116. }
  2117. function setMask(options) {
  2118. var isValidValue = function (mask, value) {
  2119. var reg = mask
  2120. .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
  2121. .replace(/_/g, '{digit+}')
  2122. .replace(/([0-9]{1})/g, '{digit$1}')
  2123. .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
  2124. .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
  2125. return (new RegExp(reg)).test(value);
  2126. },
  2127. getCaretPos = function (input) {
  2128. try {
  2129. if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
  2130. var range = options.ownerDocument.selection.createRange();
  2131. return range.getBookmark().charCodeAt(2) - 2;
  2132. }
  2133. if (input.setSelectionRange) {
  2134. return input.selectionStart;
  2135. }
  2136. } catch (e) {
  2137. return 0;
  2138. }
  2139. },
  2140. setCaretPos = function (node, pos) {
  2141. node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
  2142. if (!node) {
  2143. return false;
  2144. }
  2145. if (node.createTextRange) {
  2146. var textRange = node.createTextRange();
  2147. textRange.collapse(true);
  2148. textRange.moveEnd('character', pos);
  2149. textRange.moveStart('character', pos);
  2150. textRange.select();
  2151. return true;
  2152. }
  2153. if (node.setSelectionRange) {
  2154. node.setSelectionRange(pos, pos);
  2155. return true;
  2156. }
  2157. return false;
  2158. };
  2159. if(options.mask) {
  2160. input.off('keydown.xdsoft');
  2161. }
  2162. if (options.mask === true) {
  2163. if (dateHelper.formatMask) {
  2164. options.mask = dateHelper.formatMask(options.format)
  2165. } else {
  2166. options.mask = options.format
  2167. .replace(/Y/g, '9999')
  2168. .replace(/F/g, '9999')
  2169. .replace(/m/g, '19')
  2170. .replace(/d/g, '39')
  2171. .replace(/H/g, '29')
  2172. .replace(/i/g, '59')
  2173. .replace(/s/g, '59');
  2174. }
  2175. }
  2176. if (typeof options.mask === 'string') {
  2177. if (!isValidValue(options.mask, input.val())) {
  2178. input.val(options.mask.replace(/[0-9]/g, '_'));
  2179. setCaretPos(input[0], 0);
  2180. }
  2181. input.on('paste.xdsoft', function (event) {
  2182. // couple options here
  2183. // 1. return false - tell them they can't paste
  2184. // 2. insert over current characters - minimal validation
  2185. // 3. full fledged parsing and validation
  2186. // let's go option 2 for now
  2187. // fires multiple times for some reason
  2188. // https://stackoverflow.com/a/30496488/1366033
  2189. var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
  2190. pastedData = clipboardData.getData('text'),
  2191. val = this.value,
  2192. pos = this.selectionStart
  2193. var valueBeforeCursor = val.substr(0, pos);
  2194. var valueAfterPaste = val.substr(pos + pastedData.length);
  2195. val = valueBeforeCursor + pastedData + valueAfterPaste;
  2196. pos += pastedData.length;
  2197. if (isValidValue(options.mask, val)) {
  2198. this.value = val;
  2199. setCaretPos(this, pos);
  2200. } else if (val.trim() === '') {
  2201. this.value = options.mask.replace(/[0-9]/g, '_');
  2202. } else {
  2203. input.trigger('error_input.xdsoft');
  2204. }
  2205. event.preventDefault();
  2206. return false;
  2207. });
  2208. input.on('keydown.xdsoft', function (event) {
  2209. var val = this.value,
  2210. key = event.which,
  2211. pos = this.selectionStart,
  2212. selEnd = this.selectionEnd,
  2213. hasSel = pos !== selEnd,
  2214. digit;
  2215. // only alow these characters
  2216. if (((key >= KEY0 && key <= KEY9) ||
  2217. (key >= _KEY0 && key <= _KEY9)) ||
  2218. (key === BACKSPACE || key === DEL)) {
  2219. // get char to insert which is new character or placeholder ('_')
  2220. digit = (key === BACKSPACE || key === DEL) ? '_' :
  2221. String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key);
  2222. // we're deleting something, we're not at the start, and have normal cursor, move back one
  2223. // if we have a selection length, cursor actually sits behind deletable char, not in front
  2224. if (key === BACKSPACE && pos && !hasSel) {
  2225. pos -= 1;
  2226. }
  2227. // don't stop on a separator, continue whatever direction you were going
  2228. // value char - keep incrementing position while on separator char and we still have room
  2229. // del char - keep decrementing position while on separator char and we still have room
  2230. while (true) {
  2231. var maskValueAtCurPos = options.mask.substr(pos, 1);
  2232. var posShorterThanMaskLength = pos < options.mask.length;
  2233. var posGreaterThanZero = pos > 0;
  2234. var notNumberOrPlaceholder = /[^0-9_]/;
  2235. var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos);
  2236. var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero
  2237. // if we hit a real char, stay where we are
  2238. if (!continueMovingPosition) break;
  2239. // hitting backspace in a selection, you can possibly go back any further - go forward
  2240. pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
  2241. }
  2242. if (event.metaKey) { // cmd has been pressed
  2243. pos = 0;
  2244. hasSel = true;
  2245. }
  2246. if (hasSel) {
  2247. // pos might have moved so re-calc length
  2248. var selLength = selEnd - pos
  2249. // if we have a selection length we will wipe out entire selection and replace with default template for that range
  2250. var defaultBlank = options.mask.replace(/[0-9]/g, '_');
  2251. var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength);
  2252. var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty
  2253. var valueBeforeSel = val.substr(0, pos);
  2254. var insertChars = digit + selReplacementRemainder;
  2255. var charsAfterSelection = val.substr(pos + selLength);
  2256. val = valueBeforeSel + insertChars + charsAfterSelection
  2257. } else {
  2258. var valueBeforeCursor = val.substr(0, pos);
  2259. var insertChar = digit;
  2260. var valueAfterNextChar = val.substr(pos + 1);
  2261. val = valueBeforeCursor + insertChar + valueAfterNextChar
  2262. }
  2263. if (val.trim() === '') {
  2264. // if empty, set to default
  2265. val = defaultBlank
  2266. } else {
  2267. // if at the last character don't need to do anything
  2268. if (pos === options.mask.length) {
  2269. event.preventDefault();
  2270. return false;
  2271. }
  2272. }
  2273. // resume cursor location
  2274. pos += (key === BACKSPACE) ? 0 : 1;
  2275. // don't stop on a separator, continue whatever direction you were going
  2276. while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
  2277. pos += (key === BACKSPACE) ? 0 : 1;
  2278. }
  2279. if (isValidValue(options.mask, val)) {
  2280. this.value = val;
  2281. setCaretPos(this, pos);
  2282. } else if (val.trim() === '') {
  2283. this.value = options.mask.replace(/[0-9]/g, '_');
  2284. } else {
  2285. input.trigger('error_input.xdsoft');
  2286. }
  2287. } else {
  2288. if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
  2289. return true;
  2290. }
  2291. }
  2292. event.preventDefault();
  2293. return false;
  2294. });
  2295. }
  2296. }
  2297. _xdsoft_datetime.setCurrentTime(getCurrentValue());
  2298. input
  2299. .data('xdsoft_datetimepicker', datetimepicker)
  2300. .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
  2301. if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
  2302. return;
  2303. }
  2304. if (!options.openOnFocus) {
  2305. return;
  2306. }
  2307. clearTimeout(timer);
  2308. timer = setTimeout(function () {
  2309. if (input.is(':disabled')) {
  2310. return;
  2311. }
  2312. triggerAfterOpen = true;
  2313. _xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
  2314. if(options.mask) {
  2315. setMask(options);
  2316. }
  2317. datetimepicker.trigger('open.xdsoft');
  2318. }, 100);
  2319. })
  2320. .on('keydown.xdsoft', function (event) {
  2321. var elementSelector,
  2322. key = event.which;
  2323. if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
  2324. elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
  2325. datetimepicker.trigger('close.xdsoft');
  2326. elementSelector.eq(elementSelector.index(this) + 1).focus();
  2327. return false;
  2328. }
  2329. if ([TAB].indexOf(key) !== -1) {
  2330. datetimepicker.trigger('close.xdsoft');
  2331. return true;
  2332. }
  2333. })
  2334. .on('blur.xdsoft', function () {
  2335. datetimepicker.trigger('close.xdsoft');
  2336. });
  2337. };
  2338. destroyDateTimePicker = function (input) {
  2339. var datetimepicker = input.data('xdsoft_datetimepicker');
  2340. if (datetimepicker) {
  2341. datetimepicker.data('xdsoft_datetime', null);
  2342. datetimepicker.remove();
  2343. input
  2344. .data('xdsoft_datetimepicker', null)
  2345. .off('.xdsoft');
  2346. $(options.contentWindow).off('resize.xdsoft');
  2347. $([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
  2348. if (input.unmousewheel) {
  2349. input.unmousewheel();
  2350. }
  2351. }
  2352. };
  2353. $(options.ownerDocument)
  2354. .off('keydown.xdsoftctrl keyup.xdsoftctrl')
  2355. .off('keydown.xdsoftcmd keyup.xdsoftcmd')
  2356. .on('keydown.xdsoftctrl', function (e) {
  2357. if (e.keyCode === CTRLKEY) {
  2358. ctrlDown = true;
  2359. }
  2360. })
  2361. .on('keyup.xdsoftctrl', function (e) {
  2362. if (e.keyCode === CTRLKEY) {
  2363. ctrlDown = false;
  2364. }
  2365. })
  2366. .on('keydown.xdsoftcmd', function (e) {
  2367. if (e.keyCode === CMDKEY) {
  2368. cmdDown = true;
  2369. }
  2370. })
  2371. .on('keyup.xdsoftcmd', function (e) {
  2372. if (e.keyCode === CMDKEY) {
  2373. cmdDown = false;
  2374. }
  2375. });
  2376. this.each(function () {
  2377. var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
  2378. if (datetimepicker) {
  2379. if (typeof opt === 'string') {
  2380. switch (opt) {
  2381. case 'show':
  2382. $(this).select().focus();
  2383. datetimepicker.trigger('open.xdsoft');
  2384. break;
  2385. case 'hide':
  2386. datetimepicker.trigger('close.xdsoft');
  2387. break;
  2388. case 'toggle':
  2389. datetimepicker.trigger('toggle.xdsoft');
  2390. break;
  2391. case 'destroy':
  2392. destroyDateTimePicker($(this));
  2393. break;
  2394. case 'reset':
  2395. this.value = this.defaultValue;
  2396. if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
  2397. datetimepicker.data('changed', false);
  2398. }
  2399. datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
  2400. break;
  2401. case 'validate':
  2402. $input = datetimepicker.data('input');
  2403. $input.trigger('blur.xdsoft');
  2404. break;
  2405. default:
  2406. if (datetimepicker[opt] && typeof datetimepicker[opt] === 'function') {
  2407. result = datetimepicker[opt](opt2);
  2408. }
  2409. }
  2410. } else {
  2411. datetimepicker
  2412. .setOptions(opt);
  2413. }
  2414. return 0;
  2415. }
  2416. if (typeof opt !== 'string') {
  2417. if (!options.lazyInit || options.open || options.inline) {
  2418. createDateTimePicker($(this));
  2419. } else {
  2420. lazyInit($(this));
  2421. }
  2422. }
  2423. });
  2424. return result;
  2425. };
  2426. $.fn.datetimepicker.defaults = default_options;
  2427. function HighlightedDate(date, desc, style) {
  2428. "use strict";
  2429. this.date = date;
  2430. this.desc = desc;
  2431. this.style = style;
  2432. }
  2433. };
  2434. ;(function (factory) {
  2435. if ( typeof define === 'function' && define.amd ) {
  2436. // AMD. Register as an anonymous module.
  2437. define(['jquery', 'jquery-mousewheel'], factory);
  2438. } else if (typeof exports === 'object') {
  2439. // Node/CommonJS style for Browserify
  2440. module.exports = factory(require('jquery'));;
  2441. } else {
  2442. // Browser globals
  2443. factory(jQuery);
  2444. }
  2445. }(datetimepickerFactory));
  2446. /*!
  2447. * jQuery Mousewheel 3.1.13
  2448. *
  2449. * Copyright jQuery Foundation and other contributors
  2450. * Released under the MIT license
  2451. * http://jquery.org/license
  2452. */
  2453. (function (factory) {
  2454. if ( typeof define === 'function' && define.amd ) {
  2455. // AMD. Register as an anonymous module.
  2456. define(['jquery'], factory);
  2457. } else if (typeof exports === 'object') {
  2458. // Node/CommonJS style for Browserify
  2459. module.exports = factory;
  2460. } else {
  2461. // Browser globals
  2462. factory(jQuery);
  2463. }
  2464. }(function ($) {
  2465. var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
  2466. toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
  2467. ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
  2468. slice = Array.prototype.slice,
  2469. nullLowestDeltaTimeout, lowestDelta;
  2470. if ( $.event.fixHooks ) {
  2471. for ( var i = toFix.length; i; ) {
  2472. $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
  2473. }
  2474. }
  2475. var special = $.event.special.mousewheel = {
  2476. version: '3.1.12',
  2477. setup: function() {
  2478. if ( this.addEventListener ) {
  2479. for ( var i = toBind.length; i; ) {
  2480. this.addEventListener( toBind[--i], handler, false );
  2481. }
  2482. } else {
  2483. this.onmousewheel = handler;
  2484. }
  2485. // Store the line height and page height for this particular element
  2486. $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
  2487. $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
  2488. },
  2489. teardown: function() {
  2490. if ( this.removeEventListener ) {
  2491. for ( var i = toBind.length; i; ) {
  2492. this.removeEventListener( toBind[--i], handler, false );
  2493. }
  2494. } else {
  2495. this.onmousewheel = null;
  2496. }
  2497. // Clean up the data we added to the element
  2498. $.removeData(this, 'mousewheel-line-height');
  2499. $.removeData(this, 'mousewheel-page-height');
  2500. },
  2501. getLineHeight: function(elem) {
  2502. var $elem = $(elem),
  2503. $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
  2504. if (!$parent.length) {
  2505. $parent = $('body');
  2506. }
  2507. return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
  2508. },
  2509. getPageHeight: function(elem) {
  2510. return $(elem).height();
  2511. },
  2512. settings: {
  2513. adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
  2514. normalizeOffset: true // calls getBoundingClientRect for each event
  2515. }
  2516. };
  2517. $.fn.extend({
  2518. mousewheel: function(fn) {
  2519. return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
  2520. },
  2521. unmousewheel: function(fn) {
  2522. return this.unbind('mousewheel', fn);
  2523. }
  2524. });
  2525. function handler(event) {
  2526. var orgEvent = event || window.event,
  2527. args = slice.call(arguments, 1),
  2528. delta = 0,
  2529. deltaX = 0,
  2530. deltaY = 0,
  2531. absDelta = 0,
  2532. offsetX = 0,
  2533. offsetY = 0;
  2534. event = $.event.fix(orgEvent);
  2535. event.type = 'mousewheel';
  2536. // Old school scrollwheel delta
  2537. if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
  2538. if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
  2539. if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
  2540. if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
  2541. // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
  2542. if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
  2543. deltaX = deltaY * -1;
  2544. deltaY = 0;
  2545. }
  2546. // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
  2547. delta = deltaY === 0 ? deltaX : deltaY;
  2548. // New school wheel delta (wheel event)
  2549. if ( 'deltaY' in orgEvent ) {
  2550. deltaY = orgEvent.deltaY * -1;
  2551. delta = deltaY;
  2552. }
  2553. if ( 'deltaX' in orgEvent ) {
  2554. deltaX = orgEvent.deltaX;
  2555. if ( deltaY === 0 ) { delta = deltaX * -1; }
  2556. }
  2557. // No change actually happened, no reason to go any further
  2558. if ( deltaY === 0 && deltaX === 0 ) { return; }
  2559. // Need to convert lines and pages to pixels if we aren't already in pixels
  2560. // There are three delta modes:
  2561. // * deltaMode 0 is by pixels, nothing to do
  2562. // * deltaMode 1 is by lines
  2563. // * deltaMode 2 is by pages
  2564. if ( orgEvent.deltaMode === 1 ) {
  2565. var lineHeight = $.data(this, 'mousewheel-line-height');
  2566. delta *= lineHeight;
  2567. deltaY *= lineHeight;
  2568. deltaX *= lineHeight;
  2569. } else if ( orgEvent.deltaMode === 2 ) {
  2570. var pageHeight = $.data(this, 'mousewheel-page-height');
  2571. delta *= pageHeight;
  2572. deltaY *= pageHeight;
  2573. deltaX *= pageHeight;
  2574. }
  2575. // Store lowest absolute delta to normalize the delta values
  2576. absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
  2577. if ( !lowestDelta || absDelta < lowestDelta ) {
  2578. lowestDelta = absDelta;
  2579. // Adjust older deltas if necessary
  2580. if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
  2581. lowestDelta /= 40;
  2582. }
  2583. }
  2584. // Adjust older deltas if necessary
  2585. if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
  2586. // Divide all the things by 40!
  2587. delta /= 40;
  2588. deltaX /= 40;
  2589. deltaY /= 40;
  2590. }
  2591. // Get a whole, normalized value for the deltas
  2592. delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
  2593. deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
  2594. deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
  2595. // Normalise offsetX and offsetY properties
  2596. if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
  2597. var boundingRect = this.getBoundingClientRect();
  2598. offsetX = event.clientX - boundingRect.left;
  2599. offsetY = event.clientY - boundingRect.top;
  2600. }
  2601. // Add information to the event object
  2602. event.deltaX = deltaX;
  2603. event.deltaY = deltaY;
  2604. event.deltaFactor = lowestDelta;
  2605. event.offsetX = offsetX;
  2606. event.offsetY = offsetY;
  2607. // Go ahead and set deltaMode to 0 since we converted to pixels
  2608. // Although this is a little odd since we overwrite the deltaX/Y
  2609. // properties with normalized deltas.
  2610. event.deltaMode = 0;
  2611. // Add event and delta to the front of the arguments
  2612. args.unshift(event, delta, deltaX, deltaY);
  2613. // Clearout lowestDelta after sometime to better
  2614. // handle multiple device types that give different
  2615. // a different lowestDelta
  2616. // Ex: trackpad = 3 and mouse wheel = 120
  2617. if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
  2618. nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
  2619. return ($.event.dispatch || $.event.handle).apply(this, args);
  2620. }
  2621. function nullLowestDelta() {
  2622. lowestDelta = null;
  2623. }
  2624. function shouldAdjustOldDeltas(orgEvent, absDelta) {
  2625. // If this is an older event and the delta is divisable by 120,
  2626. // then we are assuming that the browser is treating this as an
  2627. // older mouse wheel event and that we should divide the deltas
  2628. // by 40 to try and get a more usable deltaFactor.
  2629. // Side note, this actually impacts the reported scroll distance
  2630. // in older browsers and can cause scrolling to be slower than native.
  2631. // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
  2632. return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
  2633. }
  2634. }));