bootstrap-datetimepicker.min.js 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. /*! version : 4.17.47
  2. =========================================================
  3. bootstrap-datetimejs
  4. https://github.com/Eonasdan/bootstrap-datetimepicker
  5. Copyright (c) 2015 Jonathan Peterson
  6. =========================================================
  7. */
  8. /*
  9. The MIT License (MIT)
  10. Copyright (c) 2015 Jonathan Peterson
  11. Permission is hereby granted, free of charge, to any person obtaining a copy
  12. of this software and associated documentation files (the "Software"), to deal
  13. in the Software without restriction, including without limitation the rights
  14. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. copies of the Software, and to permit persons to whom the Software is
  16. furnished to do so, subject to the following conditions:
  17. The above copyright notice and this permission notice shall be included in
  18. all copies or substantial portions of the Software.
  19. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. THE SOFTWARE.
  26. */
  27. /*global define:false */
  28. /*global exports:false */
  29. /*global require:false */
  30. /*global jQuery:false */
  31. /*global moment:false */
  32. /*
  33. Creative Tim Modifications
  34. We added class btn-primary for custom styling button.
  35. */
  36. ! function(e) {
  37. "use strict";
  38. if ("function" == typeof define && define.amd) define(["jquery", "moment"], e);
  39. else if ("object" == typeof exports) module.exports = e(require("jquery"), require("moment"));
  40. else {
  41. if ("undefined" == typeof jQuery) throw "bootstrap-datetimepicker requires jQuery to be loaded first";
  42. if ("undefined" == typeof moment) throw "bootstrap-datetimepicker requires Moment.js to be loaded first";
  43. e(jQuery, moment)
  44. }
  45. }(function(e, t) {
  46. "use strict";
  47. if (!t) throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");
  48. var n = function(n, a) {
  49. var r, i, o, s, d, l, p, c = {},
  50. u = !0,
  51. f = !1,
  52. h = !1,
  53. m = 0,
  54. y = [{
  55. clsName: "days",
  56. navFnc: "M",
  57. navStep: 1
  58. }, {
  59. clsName: "months",
  60. navFnc: "y",
  61. navStep: 1
  62. }, {
  63. clsName: "years",
  64. navFnc: "y",
  65. navStep: 10
  66. }, {
  67. clsName: "decades",
  68. navFnc: "y",
  69. navStep: 100
  70. }],
  71. b = ["days", "months", "years", "decades"],
  72. g = ["top", "bottom", "auto"],
  73. w = ["left", "right", "auto"],
  74. v = ["default", "top", "bottom"],
  75. k = {
  76. up: 38,
  77. 38: "up",
  78. down: 40,
  79. 40: "down",
  80. left: 37,
  81. 37: "left",
  82. right: 39,
  83. 39: "right",
  84. tab: 9,
  85. 9: "tab",
  86. escape: 27,
  87. 27: "escape",
  88. enter: 13,
  89. 13: "enter",
  90. pageUp: 33,
  91. 33: "pageUp",
  92. pageDown: 34,
  93. 34: "pageDown",
  94. shift: 16,
  95. 16: "shift",
  96. control: 17,
  97. 17: "control",
  98. space: 32,
  99. 32: "space",
  100. t: 84,
  101. 84: "t",
  102. delete: 46,
  103. 46: "delete"
  104. },
  105. D = {},
  106. C = function() {
  107. return void 0 !== t.tz && void 0 !== a.timeZone && null !== a.timeZone && "" !== a.timeZone
  108. },
  109. x = function(e) {
  110. var n;
  111. return n = void 0 === e || null === e ? t() : t.isDate(e) || t.isMoment(e) ? t(e) : C() ? t.tz(e, l, a.useStrict, a.timeZone) : t(e, l, a.useStrict), C() && n.tz(a.timeZone), n
  112. },
  113. T = function(e) {
  114. if ("string" != typeof e || e.length > 1) throw new TypeError("isEnabled expects a single character string parameter");
  115. switch (e) {
  116. case "y":
  117. return -1 !== d.indexOf("Y");
  118. case "M":
  119. return -1 !== d.indexOf("M");
  120. case "d":
  121. return -1 !== d.toLowerCase().indexOf("d");
  122. case "h":
  123. case "H":
  124. return -1 !== d.toLowerCase().indexOf("h");
  125. case "m":
  126. return -1 !== d.indexOf("m");
  127. case "s":
  128. return -1 !== d.indexOf("s");
  129. default:
  130. return !1
  131. }
  132. },
  133. M = function() {
  134. return T("h") || T("m") || T("s")
  135. },
  136. S = function() {
  137. return T("y") || T("M") || T("d")
  138. },
  139. O = function() {
  140. var t = e("<thead>").append(e("<tr>").append(e("<th>").addClass("prev").attr("data-action", "previous").append(e("<span>").addClass(a.icons.previous))).append(e("<th>").addClass("picker-switch").attr("data-action", "pickerSwitch").attr("colspan", a.calendarWeeks ? "6" : "5")).append(e("<th>").addClass("next").attr("data-action", "next").append(e("<span>").addClass(a.icons.next)))),
  141. n = e("<tbody>").append(e("<tr>").append(e("<td>").attr("colspan", a.calendarWeeks ? "8" : "7")));
  142. return [e("<div>").addClass("datepicker-days").append(e("<table>").addClass("table-condensed").append(t).append(e("<tbody>"))), e("<div>").addClass("datepicker-months").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())), e("<div>").addClass("datepicker-years").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())), e("<div>").addClass("datepicker-decades").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone()))]
  143. },
  144. P = function() {
  145. var t = e("<tr>"),
  146. n = e("<tr>"),
  147. r = e("<tr>");
  148. return T("h") && (t.append(e("<td>").append(e("<a>").attr({
  149. href: "#",
  150. tabindex: "-1",
  151. title: a.tooltips.incrementHour
  152. }).addClass("btn").attr("data-action", "incrementHours").append(e("<span>").addClass(a.icons.up)))), n.append(e("<td>").append(e("<span>").addClass("timepicker-hour").attr({
  153. "data-time-component": "hours",
  154. title: a.tooltips.pickHour
  155. }).attr("data-action", "showHours"))), r.append(e("<td>").append(e("<a>").attr({
  156. href: "#",
  157. tabindex: "-1",
  158. title: a.tooltips.decrementHour
  159. }).addClass("btn").attr("data-action", "decrementHours").append(e("<span>").addClass(a.icons.down))))), T("m") && (T("h") && (t.append(e("<td>").addClass("separator")), n.append(e("<td>").addClass("separator").html(":")), r.append(e("<td>").addClass("separator"))), t.append(e("<td>").append(e("<a>").attr({
  160. href: "#",
  161. tabindex: "-1",
  162. title: a.tooltips.incrementMinute
  163. }).addClass("btn").attr("data-action", "incrementMinutes").append(e("<span>").addClass(a.icons.up)))), n.append(e("<td>").append(e("<span>").addClass("timepicker-minute").attr({
  164. "data-time-component": "minutes",
  165. title: a.tooltips.pickMinute
  166. }).attr("data-action", "showMinutes"))), r.append(e("<td>").append(e("<a>").attr({
  167. href: "#",
  168. tabindex: "-1",
  169. title: a.tooltips.decrementMinute
  170. }).addClass("btn").attr("data-action", "decrementMinutes").append(e("<span>").addClass(a.icons.down))))), T("s") && (T("m") && (t.append(e("<td>").addClass("separator")), n.append(e("<td>").addClass("separator").html(":")), r.append(e("<td>").addClass("separator"))), t.append(e("<td>").append(e("<a>").attr({
  171. href: "#",
  172. tabindex: "-1",
  173. title: a.tooltips.incrementSecond
  174. }).addClass("btn btn-link").attr("data-action", "incrementSeconds").append(e("<span>").addClass(a.icons.up)))), n.append(e("<td>").append(e("<span>").addClass("timepicker-second").attr({
  175. "data-time-component": "seconds",
  176. title: a.tooltips.pickSecond
  177. }).attr("data-action", "showSeconds"))), r.append(e("<td>").append(e("<a>").attr({
  178. href: "#",
  179. tabindex: "-1",
  180. title: a.tooltips.decrementSecond
  181. }).addClass("btn btn-link").attr("data-action", "decrementSeconds").append(e("<span>").addClass(a.icons.down))))), s || (t.append(e("<td>").addClass("separator")), n.append(e("<td>").append(e("<button>").addClass("btn btn-primary").attr({
  182. "data-action": "togglePeriod",
  183. tabindex: "-1",
  184. title: a.tooltips.togglePeriod
  185. }))), r.append(e("<td>").addClass("separator"))), e("<div>").addClass("timepicker-picker").append(e("<table>").addClass("table-condensed").append([t, n, r]))
  186. },
  187. E = function() {
  188. var t = e("<div>").addClass("timepicker-hours").append(e("<table>").addClass("table-condensed")),
  189. n = e("<div>").addClass("timepicker-minutes").append(e("<table>").addClass("table-condensed")),
  190. a = e("<div>").addClass("timepicker-seconds").append(e("<table>").addClass("table-condensed")),
  191. r = [P()];
  192. return T("h") && r.push(t), T("m") && r.push(n), T("s") && r.push(a), r
  193. },
  194. H = function() {
  195. var t = [];
  196. return a.showTodayButton && t.push(e("<td>").append(e("<a>").attr({
  197. "data-action": "today",
  198. title: a.tooltips.today
  199. }).append(e("<span>").addClass(a.icons.today)))), !a.sideBySide && S() && M() && t.push(e("<td>").append(e("<a>").attr({
  200. "data-action": "togglePicker",
  201. title: a.tooltips.selectTime
  202. }).append(e("<span>").addClass(a.icons.time)))), a.showClear && t.push(e("<td>").append(e("<a>").attr({
  203. "data-action": "clear",
  204. title: a.tooltips.clear
  205. }).append(e("<span>").addClass(a.icons.clear)))), a.showClose && t.push(e("<td>").append(e("<a>").attr({
  206. "data-action": "close",
  207. title: a.tooltips.close
  208. }).append(e("<span>").addClass(a.icons.close)))), e("<table>").addClass("table-condensed").append(e("<tbody>").append(e("<tr>").append(t)))
  209. },
  210. I = function() {
  211. var t = e("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),
  212. n = e("<div>").addClass("datepicker").append(O()),
  213. r = e("<div>").addClass("timepicker").append(E()),
  214. i = e("<ul>").addClass("list-unstyled"),
  215. o = e("<li>").addClass("picker-switch" + (a.collapse ? " accordion-toggle" : "")).append(H());
  216. return a.inline && t.removeClass("dropdown-menu"), s && t.addClass("usetwentyfour"), T("s") && !s && t.addClass("wider"), a.sideBySide && S() && M() ? (t.addClass("timepicker-sbs"), "top" === a.toolbarPlacement && t.append(o), t.append(e("<div>").addClass("row").append(n.addClass("col-md-6")).append(r.addClass("col-md-6"))), "bottom" === a.toolbarPlacement && t.append(o), t) : ("top" === a.toolbarPlacement && i.append(o), S() && i.append(e("<li>").addClass(a.collapse && M() ? "collapse show" : "").append(n)), "default" === a.toolbarPlacement && i.append(o), M() && i.append(e("<li>").addClass(a.collapse && S() ? "collapse" : "").append(r)), "bottom" === a.toolbarPlacement && i.append(o), t.append(i))
  217. },
  218. Y = function() {
  219. var t, r = (f || n).position(),
  220. i = (f || n).offset(),
  221. o = a.widgetPositioning.vertical,
  222. s = a.widgetPositioning.horizontal;
  223. if (a.widgetParent) t = a.widgetParent.append(h);
  224. else if (n.is("input")) t = n.after(h).parent();
  225. else {
  226. if (a.inline) return void(t = n.append(h));
  227. t = n, n.children().first().after(h)
  228. }
  229. if ("auto" === o && (o = i.top + 1.5 * h.height() >= e(window).height() + e(window).scrollTop() && h.height() + n.outerHeight() < i.top ? "top" : "bottom"), "auto" === s && (s = t.width() < i.left + h.outerWidth() / 2 && i.left + h.outerWidth() > e(window).width() ? "right" : "left"), "top" === o ? h.addClass("top").removeClass("bottom") : h.addClass("bottom").removeClass("top"), "right" === s ? h.addClass("pull-right") : h.removeClass("pull-right"), "static" === t.css("position") && (t = t.parents().filter(function() {
  230. return "static" !== e(this).css("position")
  231. }).first()), 0 === t.length) throw new Error("datetimepicker component should be placed within a non-static positioned container");
  232. h.css({
  233. top: "top" === o ? "auto" : r.top + n.outerHeight(),
  234. bottom: "top" === o ? t.outerHeight() - (t === n ? 0 : r.top) : "auto",
  235. left: "left" === s ? t === n ? 0 : r.left : "auto",
  236. right: "left" === s ? "auto" : t.outerWidth() - n.outerWidth() - (t === n ? 0 : r.left)
  237. }), setTimeout(function() {
  238. h.addClass("open")
  239. }, 180)
  240. },
  241. q = function(e) {
  242. "dp.change" === e.type && (e.date && e.date.isSame(e.oldDate) || !e.date && !e.oldDate) || n.trigger(e)
  243. },
  244. B = function(e) {
  245. "y" === e && (e = "YYYY"), q({
  246. type: "dp.update",
  247. change: e,
  248. viewDate: i.clone()
  249. })
  250. },
  251. j = function(e) {
  252. h && (e && (p = Math.max(m, Math.min(3, p + e))), h.find(".datepicker > div").hide().filter(".datepicker-" + y[p].clsName).show())
  253. },
  254. A = function() {
  255. var t = e("<tr>"),
  256. n = i.clone().startOf("w").startOf("d");
  257. for (!0 === a.calendarWeeks && t.append(e("<th>").addClass("cw").text("#")); n.isBefore(i.clone().endOf("w"));) t.append(e("<th>").addClass("dow").text(n.format("dd"))), n.add(1, "d");
  258. h.find(".datepicker-days thead").append(t)
  259. },
  260. F = function(e) {
  261. return !0 === a.disabledDates[e.format("YYYY-MM-DD")]
  262. },
  263. L = function(e) {
  264. return !0 === a.enabledDates[e.format("YYYY-MM-DD")]
  265. },
  266. W = function(e) {
  267. return !0 === a.disabledHours[e.format("H")]
  268. },
  269. z = function(e) {
  270. return !0 === a.enabledHours[e.format("H")]
  271. },
  272. N = function(t, n) {
  273. if (!t.isValid()) return !1;
  274. if (a.disabledDates && "d" === n && F(t)) return !1;
  275. if (a.enabledDates && "d" === n && !L(t)) return !1;
  276. if (a.minDate && t.isBefore(a.minDate, n)) return !1;
  277. if (a.maxDate && t.isAfter(a.maxDate, n)) return !1;
  278. if (a.daysOfWeekDisabled && "d" === n && -1 !== a.daysOfWeekDisabled.indexOf(t.day())) return !1;
  279. if (a.disabledHours && ("h" === n || "m" === n || "s" === n) && W(t)) return !1;
  280. if (a.enabledHours && ("h" === n || "m" === n || "s" === n) && !z(t)) return !1;
  281. if (a.disabledTimeIntervals && ("h" === n || "m" === n || "s" === n)) {
  282. var r = !1;
  283. if (e.each(a.disabledTimeIntervals, function() {
  284. if (t.isBetween(this[0], this[1])) return r = !0, !1
  285. }), r) return !1
  286. }
  287. return !0
  288. },
  289. V = function() {
  290. for (var t = [], n = i.clone().startOf("y").startOf("d"); n.isSame(i, "y");) t.push(e("<span>").attr("data-action", "selectMonth").addClass("month").text(n.format("MMM"))), n.add(1, "M");
  291. h.find(".datepicker-months td").empty().append(t)
  292. },
  293. Z = function() {
  294. var t = h.find(".datepicker-months"),
  295. n = t.find("th"),
  296. o = t.find("tbody").find("span");
  297. n.eq(0).find("span").attr("title", a.tooltips.prevYear), n.eq(1).attr("title", a.tooltips.selectYear), n.eq(2).find("span").attr("title", a.tooltips.nextYear), t.find(".disabled").removeClass("disabled"), N(i.clone().subtract(1, "y"), "y") || n.eq(0).addClass("disabled"), n.eq(1).text(i.year()), N(i.clone().add(1, "y"), "y") || n.eq(2).addClass("disabled"), o.removeClass("active"), r.isSame(i, "y") && !u && o.eq(r.month()).addClass("active"), o.each(function(t) {
  298. N(i.clone().month(t), "M") || e(this).addClass("disabled")
  299. })
  300. },
  301. R = function() {
  302. var e = h.find(".datepicker-years"),
  303. t = e.find("th"),
  304. n = i.clone().subtract(5, "y"),
  305. o = i.clone().add(6, "y"),
  306. s = "";
  307. for (t.eq(0).find("span").attr("title", a.tooltips.prevDecade), t.eq(1).attr("title", a.tooltips.selectDecade), t.eq(2).find("span").attr("title", a.tooltips.nextDecade), e.find(".disabled").removeClass("disabled"), a.minDate && a.minDate.isAfter(n, "y") && t.eq(0).addClass("disabled"), t.eq(1).text(n.year() + "-" + o.year()), a.maxDate && a.maxDate.isBefore(o, "y") && t.eq(2).addClass("disabled"); !n.isAfter(o, "y");) s += '<span data-action="selectYear" class="year' + (n.isSame(r, "y") && !u ? " active" : "") + (N(n, "y") ? "" : " disabled") + '">' + n.year() + "</span>", n.add(1, "y");
  308. e.find("td").html(s)
  309. },
  310. Q = function() {
  311. var e, n = h.find(".datepicker-decades"),
  312. o = n.find("th"),
  313. s = t({
  314. y: i.year() - i.year() % 100 - 1
  315. }),
  316. d = s.clone().add(100, "y"),
  317. l = s.clone(),
  318. p = !1,
  319. c = !1,
  320. u = "";
  321. for (o.eq(0).find("span").attr("title", a.tooltips.prevCentury), o.eq(2).find("span").attr("title", a.tooltips.nextCentury), n.find(".disabled").removeClass("disabled"), (s.isSame(t({
  322. y: 1900
  323. })) || a.minDate && a.minDate.isAfter(s, "y")) && o.eq(0).addClass("disabled"), o.eq(1).text(s.year() + "-" + d.year()), (s.isSame(t({
  324. y: 2e3
  325. })) || a.maxDate && a.maxDate.isBefore(d, "y")) && o.eq(2).addClass("disabled"); !s.isAfter(d, "y");) e = s.year() + 12, p = a.minDate && a.minDate.isAfter(s, "y") && a.minDate.year() <= e, c = a.maxDate && a.maxDate.isAfter(s, "y") && a.maxDate.year() <= e, u += '<span data-action="selectDecade" class="decade' + (r.isAfter(s) && r.year() <= e ? " active" : "") + (N(s, "y") || p || c ? "" : " disabled") + '" data-selection="' + (s.year() + 6) + '">' + (s.year() + 1) + " - " + (s.year() + 12) + "</span>", s.add(12, "y");
  326. u += "<span></span><span></span><span></span>", n.find("td").html(u), o.eq(1).text(l.year() + 1 + "-" + s.year())
  327. },
  328. U = function() {
  329. var t, n, o, s = h.find(".datepicker-days"),
  330. d = s.find("th"),
  331. l = [],
  332. p = [];
  333. if (S()) {
  334. for (d.eq(0).find("span").attr("title", a.tooltips.prevMonth), d.eq(1).attr("title", a.tooltips.selectMonth), d.eq(2).find("span").attr("title", a.tooltips.nextMonth), s.find(".disabled").removeClass("disabled"), d.eq(1).text(i.format(a.dayViewHeaderFormat)), N(i.clone().subtract(1, "M"), "M") || d.eq(0).addClass("disabled"), N(i.clone().add(1, "M"), "M") || d.eq(2).addClass("disabled"), t = i.clone().startOf("M").startOf("w").startOf("d"), o = 0; o < 42; o++) 0 === t.weekday() && (n = e("<tr>"), a.calendarWeeks && n.append('<td class="cw">' + t.week() + "</td>"), l.push(n)), p = ["day"], t.isBefore(i, "M") && p.push("old"), t.isAfter(i, "M") && p.push("new"), t.isSame(r, "d") && !u && p.push("active"), N(t, "d") || p.push("disabled"), t.isSame(x(), "d") && p.push("today"), 0 !== t.day() && 6 !== t.day() || p.push("weekend"), q({
  335. type: "dp.classify",
  336. date: t,
  337. classNames: p
  338. }), n.append('<td data-action="selectDay" data-day="' + t.format("L") + '" class="' + p.join(" ") + '"><div>' + t.date() + "</div></td>"), t.add(1, "d");
  339. s.find("tbody").empty().append(l), Z(), R(), Q()
  340. }
  341. },
  342. G = function() {
  343. var t = h.find(".timepicker-hours table"),
  344. n = i.clone().startOf("d"),
  345. a = [],
  346. r = e("<tr>");
  347. for (i.hour() > 11 && !s && n.hour(12); n.isSame(i, "d") && (s || i.hour() < 12 && n.hour() < 12 || i.hour() > 11);) n.hour() % 4 == 0 && (r = e("<tr>"), a.push(r)), r.append('<td data-action="selectHour" class="hour' + (N(n, "h") ? "" : " disabled") + '"><div>' + n.format(s ? "HH" : "hh") + "</div></td>"), n.add(1, "h");
  348. t.empty().append(a)
  349. },
  350. J = function() {
  351. for (var t = h.find(".timepicker-minutes table"), n = i.clone().startOf("h"), r = [], o = e("<tr>"), s = 1 === a.stepping ? 5 : a.stepping; i.isSame(n, "h");) n.minute() % (4 * s) == 0 && (o = e("<tr>"), r.push(o)), o.append('<td data-action="selectMinute" class="minute' + (N(n, "m") ? "" : " disabled") + '"><div>' + n.format("mm") + "</div></td>"), n.add(s, "m");
  352. t.empty().append(r)
  353. },
  354. K = function() {
  355. for (var t = h.find(".timepicker-seconds table"), n = i.clone().startOf("m"), a = [], r = e("<tr>"); i.isSame(n, "m");) n.second() % 20 == 0 && (r = e("<tr>"), a.push(r)), r.append('<td data-action="selectSecond" class="second' + (N(n, "s") ? "" : " disabled") + '"><div>' + n.format("ss") + "</div></td>"), n.add(5, "s");
  356. t.empty().append(a)
  357. },
  358. X = function() {
  359. var e, t, n = h.find(".timepicker span[data-time-component]");
  360. s || (e = h.find(".timepicker [data-action=togglePeriod]"), t = r.clone().add(r.hours() >= 12 ? -12 : 12, "h"), e.text(r.format("A")), N(t, "h") ? e.removeClass("disabled") : e.addClass("disabled")), n.filter("[data-time-component=hours]").text(r.format(s ? "HH" : "hh")), n.filter("[data-time-component=minutes]").text(r.format("mm")), n.filter("[data-time-component=seconds]").text(r.format("ss")), G(), J(), K()
  361. },
  362. $ = function() {
  363. h && (U(), X())
  364. },
  365. _ = function(e) {
  366. var t = u ? null : r;
  367. if (!e) return u = !0, o.val(""), n.data("date", ""), q({
  368. type: "dp.change",
  369. date: !1,
  370. oldDate: t
  371. }), void $();
  372. if (e = e.clone().locale(a.locale), C() && e.tz(a.timeZone), 1 !== a.stepping)
  373. for (e.minutes(Math.round(e.minutes() / a.stepping) * a.stepping).seconds(0); a.minDate && e.isBefore(a.minDate);) e.add(a.stepping, "minutes");
  374. N(e) ? (i = (r = e).clone(), o.val(r.format(d)), n.data("date", r.format(d)), u = !1, $(), q({
  375. type: "dp.change",
  376. date: r.clone(),
  377. oldDate: t
  378. })) : (a.keepInvalid ? q({
  379. type: "dp.change",
  380. date: e,
  381. oldDate: t
  382. }) : o.val(u ? "" : r.format(d)), q({
  383. type: "dp.error",
  384. date: e,
  385. oldDate: t
  386. }))
  387. },
  388. ee = function() {
  389. var t = !1;
  390. return h ? (h.find(".collapse").each(function() {
  391. var n = e(this).data("collapse");
  392. return !n || !n.transitioning || (t = !0, !1)
  393. }), t ? c : (f && f.hasClass("btn") && f.toggleClass("active"), e(window).off("resize", Y), h.off("click", "[data-action]"), h.off("mousedown", !1), h.removeClass("open"), void setTimeout(function() {
  394. return h.remove(), h.hide(), h = !1, q({
  395. type: "dp.hide",
  396. date: r.clone()
  397. }), o.blur(), p = 0, i = r.clone(), c
  398. }, 400))) : c
  399. },
  400. te = function() {
  401. _(null)
  402. },
  403. ne = function(e) {
  404. return void 0 === a.parseInputDate ? (!t.isMoment(e) || e instanceof Date) && (e = x(e)) : e = a.parseInputDate(e), e
  405. },
  406. ae = {
  407. next: function() {
  408. var e = y[p].navFnc;
  409. i.add(y[p].navStep, e), U(), B(e)
  410. },
  411. previous: function() {
  412. var e = y[p].navFnc;
  413. i.subtract(y[p].navStep, e), U(), B(e)
  414. },
  415. pickerSwitch: function() {
  416. j(1)
  417. },
  418. selectMonth: function(t) {
  419. var n = e(t.target).closest("tbody").find("span").index(e(t.target));
  420. i.month(n), p === m ? (_(r.clone().year(i.year()).month(i.month())), a.inline || ee()) : (j(-1), U()), B("M")
  421. },
  422. selectYear: function(t) {
  423. var n = parseInt(e(t.target).text(), 10) || 0;
  424. i.year(n), p === m ? (_(r.clone().year(i.year())), a.inline || ee()) : (j(-1), U()), B("YYYY")
  425. },
  426. selectDecade: function(t) {
  427. var n = parseInt(e(t.target).data("selection"), 10) || 0;
  428. i.year(n), p === m ? (_(r.clone().year(i.year())), a.inline || ee()) : (j(-1), U()), B("YYYY")
  429. },
  430. selectDay: function(t) {
  431. var n = i.clone();
  432. e(t.target).is(".old") && n.subtract(1, "M"), e(t.target).is(".new") && n.add(1, "M"), _(n.date(parseInt(e(t.target).text(), 10))), M() || a.keepOpen || a.inline || ee()
  433. },
  434. incrementHours: function() {
  435. var e = r.clone().add(1, "h");
  436. N(e, "h") && _(e)
  437. },
  438. incrementMinutes: function() {
  439. var e = r.clone().add(a.stepping, "m");
  440. N(e, "m") && _(e)
  441. },
  442. incrementSeconds: function() {
  443. var e = r.clone().add(1, "s");
  444. N(e, "s") && _(e)
  445. },
  446. decrementHours: function() {
  447. var e = r.clone().subtract(1, "h");
  448. N(e, "h") && _(e)
  449. },
  450. decrementMinutes: function() {
  451. var e = r.clone().subtract(a.stepping, "m");
  452. N(e, "m") && _(e)
  453. },
  454. decrementSeconds: function() {
  455. var e = r.clone().subtract(1, "s");
  456. N(e, "s") && _(e)
  457. },
  458. togglePeriod: function() {
  459. _(r.clone().add(r.hours() >= 12 ? -12 : 12, "h"))
  460. },
  461. togglePicker: function(t) {
  462. var n, r = e(t.target),
  463. i = r.closest("ul"),
  464. o = i.find(".show"),
  465. s = i.find(".collapse:not(.show)");
  466. if (o && o.length) {
  467. if ((n = o.data("collapse")) && n.transitioning) return;
  468. o.collapse ? (o.collapse("hide"), s.collapse("show")) : (o.removeClass("show"), s.addClass("show")), r.is("span") ? r.toggleClass(a.icons.time + " " + a.icons.date) : r.find("span").toggleClass(a.icons.time + " " + a.icons.date)
  469. }
  470. },
  471. showPicker: function() {
  472. h.find(".timepicker > div:not(.timepicker-picker)").hide(), h.find(".timepicker .timepicker-picker").show()
  473. },
  474. showHours: function() {
  475. h.find(".timepicker .timepicker-picker").hide(), h.find(".timepicker .timepicker-hours").show()
  476. },
  477. showMinutes: function() {
  478. h.find(".timepicker .timepicker-picker").hide(), h.find(".timepicker .timepicker-minutes").show()
  479. },
  480. showSeconds: function() {
  481. h.find(".timepicker .timepicker-picker").hide(), h.find(".timepicker .timepicker-seconds").show()
  482. },
  483. selectHour: function(t) {
  484. var n = parseInt(e(t.target).text(), 10);
  485. s || (r.hours() >= 12 ? 12 !== n && (n += 12) : 12 === n && (n = 0)), _(r.clone().hours(n)), ae.showPicker.call(c)
  486. },
  487. selectMinute: function(t) {
  488. _(r.clone().minutes(parseInt(e(t.target).text(), 10))), ae.showPicker.call(c)
  489. },
  490. selectSecond: function(t) {
  491. _(r.clone().seconds(parseInt(e(t.target).text(), 10))), ae.showPicker.call(c)
  492. },
  493. clear: te,
  494. today: function() {
  495. var e = x();
  496. N(e, "d") && _(e)
  497. },
  498. close: ee
  499. },
  500. re = function(t) {
  501. return !e(t.currentTarget).is(".disabled") && (ae[e(t.currentTarget).data("action")].apply(c, arguments), !1)
  502. },
  503. ie = function() {
  504. var t, n = {
  505. year: function(e) {
  506. return e.month(0).date(1).hours(0).seconds(0).minutes(0)
  507. },
  508. month: function(e) {
  509. return e.date(1).hours(0).seconds(0).minutes(0)
  510. },
  511. day: function(e) {
  512. return e.hours(0).seconds(0).minutes(0)
  513. },
  514. hour: function(e) {
  515. return e.seconds(0).minutes(0)
  516. },
  517. minute: function(e) {
  518. return e.seconds(0)
  519. }
  520. };
  521. return o.prop("disabled") || !a.ignoreReadonly && o.prop("readonly") || h ? c : (void 0 !== o.val() && 0 !== o.val().trim().length ? _(ne(o.val().trim())) : u && a.useCurrent && (a.inline || o.is("input") && 0 === o.val().trim().length) && (t = x(), "string" == typeof a.useCurrent && (t = n[a.useCurrent](t)), _(t)), h = I(), A(), V(), h.find(".timepicker-hours").hide(), h.find(".timepicker-minutes").hide(), h.find(".timepicker-seconds").hide(), $(), j(), e(window).on("resize", Y), h.on("click", "[data-action]", re), h.on("mousedown", !1), f && f.hasClass("btn") && f.toggleClass("active"), Y(), h.show(), a.focusOnShow && !o.is(":focus") && o.focus(), q({
  522. type: "dp.show"
  523. }), c)
  524. },
  525. oe = function() {
  526. return h ? ee() : ie()
  527. },
  528. se = function(e) {
  529. var t, n, r, i, o = null,
  530. s = [],
  531. d = {},
  532. l = e.which;
  533. D[l] = "p";
  534. for (t in D) D.hasOwnProperty(t) && "p" === D[t] && (s.push(t), parseInt(t, 10) !== l && (d[t] = !0));
  535. for (t in a.keyBinds)
  536. if (a.keyBinds.hasOwnProperty(t) && "function" == typeof a.keyBinds[t] && (r = t.split(" ")).length === s.length && k[l] === r[r.length - 1]) {
  537. for (i = !0, n = r.length - 2; n >= 0; n--)
  538. if (!(k[r[n]] in d)) {
  539. i = !1;
  540. break
  541. }
  542. if (i) {
  543. o = a.keyBinds[t];
  544. break
  545. }
  546. }
  547. o && (o.call(c, h), e.stopPropagation(), e.preventDefault())
  548. },
  549. de = function(e) {
  550. D[e.which] = "r", e.stopPropagation(), e.preventDefault()
  551. },
  552. le = function(t) {
  553. var n = e(t.target).val().trim(),
  554. a = n ? ne(n) : null;
  555. return _(a), t.stopImmediatePropagation(), !1
  556. },
  557. pe = function() {
  558. o.off({
  559. change: le,
  560. blur: blur,
  561. keydown: se,
  562. keyup: de,
  563. focus: a.allowInputToggle ? ee : ""
  564. }), n.is("input") ? o.off({
  565. focus: ie
  566. }) : f && (f.off("click", oe), f.off("mousedown", !1))
  567. },
  568. ce = function(t) {
  569. var n = {};
  570. return e.each(t, function() {
  571. var e = ne(this);
  572. e.isValid() && (n[e.format("YYYY-MM-DD")] = !0)
  573. }), !!Object.keys(n).length && n
  574. },
  575. ue = function(t) {
  576. var n = {};
  577. return e.each(t, function() {
  578. n[this] = !0
  579. }), !!Object.keys(n).length && n
  580. },
  581. fe = function() {
  582. var e = a.format || "L LT";
  583. d = e.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function(e) {
  584. return (r.localeData().longDateFormat(e) || e).replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function(e) {
  585. return r.localeData().longDateFormat(e) || e
  586. })
  587. }), (l = a.extraFormats ? a.extraFormats.slice() : []).indexOf(e) < 0 && l.indexOf(d) < 0 && l.push(d), s = d.toLowerCase().indexOf("a") < 1 && d.replace(/\[.*?\]/g, "").indexOf("h") < 1, T("y") && (m = 2), T("M") && (m = 1), T("d") && (m = 0), p = Math.max(m, p), u || _(r)
  588. };
  589. if (c.destroy = function() {
  590. ee(), pe(), n.removeData("DateTimePicker"), n.removeData("date")
  591. }, c.toggle = oe, c.show = ie, c.hide = ee, c.disable = function() {
  592. return ee(), f && f.hasClass("btn") && f.addClass("disabled"), o.prop("disabled", !0), c
  593. }, c.enable = function() {
  594. return f && f.hasClass("btn") && f.removeClass("disabled"), o.prop("disabled", !1), c
  595. }, c.ignoreReadonly = function(e) {
  596. if (0 === arguments.length) return a.ignoreReadonly;
  597. if ("boolean" != typeof e) throw new TypeError("ignoreReadonly () expects a boolean parameter");
  598. return a.ignoreReadonly = e, c
  599. }, c.options = function(t) {
  600. if (0 === arguments.length) return e.extend(!0, {}, a);
  601. if (!(t instanceof Object)) throw new TypeError("options() options parameter should be an object");
  602. return e.extend(!0, a, t), e.each(a, function(e, t) {
  603. if (void 0 === c[e]) throw new TypeError("option " + e + " is not recognized!");
  604. c[e](t)
  605. }), c
  606. }, c.date = function(e) {
  607. if (0 === arguments.length) return u ? null : r.clone();
  608. if (!(null === e || "string" == typeof e || t.isMoment(e) || e instanceof Date)) throw new TypeError("date() parameter must be one of [null, string, moment or Date]");
  609. return _(null === e ? null : ne(e)), c
  610. }, c.format = function(e) {
  611. if (0 === arguments.length) return a.format;
  612. if ("string" != typeof e && ("boolean" != typeof e || !1 !== e)) throw new TypeError("format() expects a string or boolean:false parameter " + e);
  613. return a.format = e, d && fe(), c
  614. }, c.timeZone = function(e) {
  615. if (0 === arguments.length) return a.timeZone;
  616. if ("string" != typeof e) throw new TypeError("newZone() expects a string parameter");
  617. return a.timeZone = e, c
  618. }, c.dayViewHeaderFormat = function(e) {
  619. if (0 === arguments.length) return a.dayViewHeaderFormat;
  620. if ("string" != typeof e) throw new TypeError("dayViewHeaderFormat() expects a string parameter");
  621. return a.dayViewHeaderFormat = e, c
  622. }, c.extraFormats = function(e) {
  623. if (0 === arguments.length) return a.extraFormats;
  624. if (!1 !== e && !(e instanceof Array)) throw new TypeError("extraFormats() expects an array or false parameter");
  625. return a.extraFormats = e, l && fe(), c
  626. }, c.disabledDates = function(t) {
  627. if (0 === arguments.length) return a.disabledDates ? e.extend({}, a.disabledDates) : a.disabledDates;
  628. if (!t) return a.disabledDates = !1, $(), c;
  629. if (!(t instanceof Array)) throw new TypeError("disabledDates() expects an array parameter");
  630. return a.disabledDates = ce(t), a.enabledDates = !1, $(), c
  631. }, c.enabledDates = function(t) {
  632. if (0 === arguments.length) return a.enabledDates ? e.extend({}, a.enabledDates) : a.enabledDates;
  633. if (!t) return a.enabledDates = !1, $(), c;
  634. if (!(t instanceof Array)) throw new TypeError("enabledDates() expects an array parameter");
  635. return a.enabledDates = ce(t), a.disabledDates = !1, $(), c
  636. }, c.daysOfWeekDisabled = function(e) {
  637. if (0 === arguments.length) return a.daysOfWeekDisabled.splice(0);
  638. if ("boolean" == typeof e && !e) return a.daysOfWeekDisabled = !1, $(), c;
  639. if (!(e instanceof Array)) throw new TypeError("daysOfWeekDisabled() expects an array parameter");
  640. if (a.daysOfWeekDisabled = e.reduce(function(e, t) {
  641. return (t = parseInt(t, 10)) > 6 || t < 0 || isNaN(t) ? e : (-1 === e.indexOf(t) && e.push(t), e)
  642. }, []).sort(), a.useCurrent && !a.keepInvalid) {
  643. for (var t = 0; !N(r, "d");) {
  644. if (r.add(1, "d"), 31 === t) throw "Tried 31 times to find a valid date";
  645. t++
  646. }
  647. _(r)
  648. }
  649. return $(), c
  650. }, c.maxDate = function(e) {
  651. if (0 === arguments.length) return a.maxDate ? a.maxDate.clone() : a.maxDate;
  652. if ("boolean" == typeof e && !1 === e) return a.maxDate = !1, $(), c;
  653. "string" == typeof e && ("now" !== e && "moment" !== e || (e = x()));
  654. var t = ne(e);
  655. if (!t.isValid()) throw new TypeError("maxDate() Could not parse date parameter: " + e);
  656. if (a.minDate && t.isBefore(a.minDate)) throw new TypeError("maxDate() date parameter is before options.minDate: " + t.format(d));
  657. return a.maxDate = t, a.useCurrent && !a.keepInvalid && r.isAfter(e) && _(a.maxDate), i.isAfter(t) && (i = t.clone().subtract(a.stepping, "m")), $(), c
  658. }, c.minDate = function(e) {
  659. if (0 === arguments.length) return a.minDate ? a.minDate.clone() : a.minDate;
  660. if ("boolean" == typeof e && !1 === e) return a.minDate = !1, $(), c;
  661. "string" == typeof e && ("now" !== e && "moment" !== e || (e = x()));
  662. var t = ne(e);
  663. if (!t.isValid()) throw new TypeError("minDate() Could not parse date parameter: " + e);
  664. if (a.maxDate && t.isAfter(a.maxDate)) throw new TypeError("minDate() date parameter is after options.maxDate: " + t.format(d));
  665. return a.minDate = t, a.useCurrent && !a.keepInvalid && r.isBefore(e) && _(a.minDate), i.isBefore(t) && (i = t.clone().add(a.stepping, "m")), $(), c
  666. }, c.defaultDate = function(e) {
  667. if (0 === arguments.length) return a.defaultDate ? a.defaultDate.clone() : a.defaultDate;
  668. if (!e) return a.defaultDate = !1, c;
  669. "string" == typeof e && (e = "now" === e || "moment" === e ? x() : x(e));
  670. var t = ne(e);
  671. if (!t.isValid()) throw new TypeError("defaultDate() Could not parse date parameter: " + e);
  672. if (!N(t)) throw new TypeError("defaultDate() date passed is invalid according to component setup validations");
  673. return a.defaultDate = t, (a.defaultDate && a.inline || "" === o.val().trim()) && _(a.defaultDate), c
  674. }, c.locale = function(e) {
  675. if (0 === arguments.length) return a.locale;
  676. if (!t.localeData(e)) throw new TypeError("locale() locale " + e + " is not loaded from moment locales!");
  677. return a.locale = e, r.locale(a.locale), i.locale(a.locale), d && fe(), h && (ee(), ie()), c
  678. }, c.stepping = function(e) {
  679. return 0 === arguments.length ? a.stepping : (e = parseInt(e, 10), (isNaN(e) || e < 1) && (e = 1), a.stepping = e, c)
  680. }, c.useCurrent = function(e) {
  681. var t = ["year", "month", "day", "hour", "minute"];
  682. if (0 === arguments.length) return a.useCurrent;
  683. if ("boolean" != typeof e && "string" != typeof e) throw new TypeError("useCurrent() expects a boolean or string parameter");
  684. if ("string" == typeof e && -1 === t.indexOf(e.toLowerCase())) throw new TypeError("useCurrent() expects a string parameter of " + t.join(", "));
  685. return a.useCurrent = e, c
  686. }, c.collapse = function(e) {
  687. if (0 === arguments.length) return a.collapse;
  688. if ("boolean" != typeof e) throw new TypeError("collapse() expects a boolean parameter");
  689. return a.collapse === e ? c : (a.collapse = e, h && (ee(), ie()), c)
  690. }, c.icons = function(t) {
  691. if (0 === arguments.length) return e.extend({}, a.icons);
  692. if (!(t instanceof Object)) throw new TypeError("icons() expects parameter to be an Object");
  693. return e.extend(a.icons, t), h && (ee(), ie()), c
  694. }, c.tooltips = function(t) {
  695. if (0 === arguments.length) return e.extend({}, a.tooltips);
  696. if (!(t instanceof Object)) throw new TypeError("tooltips() expects parameter to be an Object");
  697. return e.extend(a.tooltips, t), h && (ee(), ie()), c
  698. }, c.useStrict = function(e) {
  699. if (0 === arguments.length) return a.useStrict;
  700. if ("boolean" != typeof e) throw new TypeError("useStrict() expects a boolean parameter");
  701. return a.useStrict = e, c
  702. }, c.sideBySide = function(e) {
  703. if (0 === arguments.length) return a.sideBySide;
  704. if ("boolean" != typeof e) throw new TypeError("sideBySide() expects a boolean parameter");
  705. return a.sideBySide = e, h && (ee(), ie()), c
  706. }, c.viewMode = function(e) {
  707. if (0 === arguments.length) return a.viewMode;
  708. if ("string" != typeof e) throw new TypeError("viewMode() expects a string parameter");
  709. if (-1 === b.indexOf(e)) throw new TypeError("viewMode() parameter must be one of (" + b.join(", ") + ") value");
  710. return a.viewMode = e, p = Math.max(b.indexOf(e), m), j(), c
  711. }, c.toolbarPlacement = function(e) {
  712. if (0 === arguments.length) return a.toolbarPlacement;
  713. if ("string" != typeof e) throw new TypeError("toolbarPlacement() expects a string parameter");
  714. if (-1 === v.indexOf(e)) throw new TypeError("toolbarPlacement() parameter must be one of (" + v.join(", ") + ") value");
  715. return a.toolbarPlacement = e, h && (ee(), ie()), c
  716. }, c.widgetPositioning = function(t) {
  717. if (0 === arguments.length) return e.extend({}, a.widgetPositioning);
  718. if ("[object Object]" !== {}.toString.call(t)) throw new TypeError("widgetPositioning() expects an object variable");
  719. if (t.horizontal) {
  720. if ("string" != typeof t.horizontal) throw new TypeError("widgetPositioning() horizontal variable must be a string");
  721. if (t.horizontal = t.horizontal.toLowerCase(), -1 === w.indexOf(t.horizontal)) throw new TypeError("widgetPositioning() expects horizontal parameter to be one of (" + w.join(", ") + ")");
  722. a.widgetPositioning.horizontal = t.horizontal
  723. }
  724. if (t.vertical) {
  725. if ("string" != typeof t.vertical) throw new TypeError("widgetPositioning() vertical variable must be a string");
  726. if (t.vertical = t.vertical.toLowerCase(), -1 === g.indexOf(t.vertical)) throw new TypeError("widgetPositioning() expects vertical parameter to be one of (" + g.join(", ") + ")");
  727. a.widgetPositioning.vertical = t.vertical
  728. }
  729. return $(), c
  730. }, c.calendarWeeks = function(e) {
  731. if (0 === arguments.length) return a.calendarWeeks;
  732. if ("boolean" != typeof e) throw new TypeError("calendarWeeks() expects parameter to be a boolean value");
  733. return a.calendarWeeks = e, $(), c
  734. }, c.showTodayButton = function(e) {
  735. if (0 === arguments.length) return a.showTodayButton;
  736. if ("boolean" != typeof e) throw new TypeError("showTodayButton() expects a boolean parameter");
  737. return a.showTodayButton = e, h && (ee(), ie()), c
  738. }, c.showClear = function(e) {
  739. if (0 === arguments.length) return a.showClear;
  740. if ("boolean" != typeof e) throw new TypeError("showClear() expects a boolean parameter");
  741. return a.showClear = e, h && (ee(), ie()), c
  742. }, c.widgetParent = function(t) {
  743. if (0 === arguments.length) return a.widgetParent;
  744. if ("string" == typeof t && (t = e(t)), null !== t && "string" != typeof t && !(t instanceof e)) throw new TypeError("widgetParent() expects a string or a jQuery object parameter");
  745. return a.widgetParent = t, h && (ee(), ie()), c
  746. }, c.keepOpen = function(e) {
  747. if (0 === arguments.length) return a.keepOpen;
  748. if ("boolean" != typeof e) throw new TypeError("keepOpen() expects a boolean parameter");
  749. return a.keepOpen = e, c
  750. }, c.focusOnShow = function(e) {
  751. if (0 === arguments.length) return a.focusOnShow;
  752. if ("boolean" != typeof e) throw new TypeError("focusOnShow() expects a boolean parameter");
  753. return a.focusOnShow = e, c
  754. }, c.inline = function(e) {
  755. if (0 === arguments.length) return a.inline;
  756. if ("boolean" != typeof e) throw new TypeError("inline() expects a boolean parameter");
  757. return a.inline = e, c
  758. }, c.clear = function() {
  759. return te(), c
  760. }, c.keyBinds = function(e) {
  761. return 0 === arguments.length ? a.keyBinds : (a.keyBinds = e, c)
  762. }, c.getMoment = function(e) {
  763. return x(e)
  764. }, c.debug = function(e) {
  765. if ("boolean" != typeof e) throw new TypeError("debug() expects a boolean parameter");
  766. return a.debug = e, c
  767. }, c.allowInputToggle = function(e) {
  768. if (0 === arguments.length) return a.allowInputToggle;
  769. if ("boolean" != typeof e) throw new TypeError("allowInputToggle() expects a boolean parameter");
  770. return a.allowInputToggle = e, c
  771. }, c.showClose = function(e) {
  772. if (0 === arguments.length) return a.showClose;
  773. if ("boolean" != typeof e) throw new TypeError("showClose() expects a boolean parameter");
  774. return a.showClose = e, c
  775. }, c.keepInvalid = function(e) {
  776. if (0 === arguments.length) return a.keepInvalid;
  777. if ("boolean" != typeof e) throw new TypeError("keepInvalid() expects a boolean parameter");
  778. return a.keepInvalid = e, c
  779. }, c.datepickerInput = function(e) {
  780. if (0 === arguments.length) return a.datepickerInput;
  781. if ("string" != typeof e) throw new TypeError("datepickerInput() expects a string parameter");
  782. return a.datepickerInput = e, c
  783. }, c.parseInputDate = function(e) {
  784. if (0 === arguments.length) return a.parseInputDate;
  785. if ("function" != typeof e) throw new TypeError("parseInputDate() sholud be as function");
  786. return a.parseInputDate = e, c
  787. }, c.disabledTimeIntervals = function(t) {
  788. if (0 === arguments.length) return a.disabledTimeIntervals ? e.extend({}, a.disabledTimeIntervals) : a.disabledTimeIntervals;
  789. if (!t) return a.disabledTimeIntervals = !1, $(), c;
  790. if (!(t instanceof Array)) throw new TypeError("disabledTimeIntervals() expects an array parameter");
  791. return a.disabledTimeIntervals = t, $(), c
  792. }, c.disabledHours = function(t) {
  793. if (0 === arguments.length) return a.disabledHours ? e.extend({}, a.disabledHours) : a.disabledHours;
  794. if (!t) return a.disabledHours = !1, $(), c;
  795. if (!(t instanceof Array)) throw new TypeError("disabledHours() expects an array parameter");
  796. if (a.disabledHours = ue(t), a.enabledHours = !1, a.useCurrent && !a.keepInvalid) {
  797. for (var n = 0; !N(r, "h");) {
  798. if (r.add(1, "h"), 24 === n) throw "Tried 24 times to find a valid date";
  799. n++
  800. }
  801. _(r)
  802. }
  803. return $(), c
  804. }, c.enabledHours = function(t) {
  805. if (0 === arguments.length) return a.enabledHours ? e.extend({}, a.enabledHours) : a.enabledHours;
  806. if (!t) return a.enabledHours = !1, $(), c;
  807. if (!(t instanceof Array)) throw new TypeError("enabledHours() expects an array parameter");
  808. if (a.enabledHours = ue(t), a.disabledHours = !1, a.useCurrent && !a.keepInvalid) {
  809. for (var n = 0; !N(r, "h");) {
  810. if (r.add(1, "h"), 24 === n) throw "Tried 24 times to find a valid date";
  811. n++
  812. }
  813. _(r)
  814. }
  815. return $(), c
  816. }, c.viewDate = function(e) {
  817. if (0 === arguments.length) return i.clone();
  818. if (!e) return i = r.clone(), c;
  819. if (!("string" == typeof e || t.isMoment(e) || e instanceof Date)) throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");
  820. return i = ne(e), B(), c
  821. }, n.is("input")) o = n;
  822. else if (0 === (o = n.find(a.datepickerInput)).length) o = n.find("input");
  823. else if (!o.is("input")) throw new Error('CSS class "' + a.datepickerInput + '" cannot be applied to non input element');
  824. if (n.hasClass("input-group") && (f = 0 === n.find(".datepickerbutton").length ? n.find(".input-group-addon") : n.find(".datepickerbutton")), !a.inline && !o.is("input")) throw new Error("Could not initialize DateTimePicker without an input element");
  825. return r = x(), i = r.clone(), e.extend(!0, a, function() {
  826. var t, r = {};
  827. return (t = n.is("input") || a.inline ? n.data() : n.find("input").data()).dateOptions && t.dateOptions instanceof Object && (r = e.extend(!0, r, t.dateOptions)), e.each(a, function(e) {
  828. var n = "date" + e.charAt(0).toUpperCase() + e.slice(1);
  829. void 0 !== t[n] && (r[e] = t[n])
  830. }), r
  831. }()), c.options(a), fe(), o.on({
  832. change: le,
  833. blur: a.debug ? "" : ee,
  834. keydown: se,
  835. keyup: de,
  836. focus: a.allowInputToggle ? ie : ""
  837. }), n.is("input") ? o.on({
  838. focus: ie
  839. }) : f && (f.on("click", oe), f.on("mousedown", !1)), o.prop("disabled") && c.disable(), o.is("input") && 0 !== o.val().trim().length ? _(ne(o.val().trim())) : a.defaultDate && void 0 === o.attr("placeholder") && _(a.defaultDate), a.inline && ie(), c
  840. };
  841. return e.fn.datetimepicker = function(t) {
  842. t = t || {};
  843. var a, r = Array.prototype.slice.call(arguments, 1),
  844. i = !0,
  845. o = ["destroy", "hide", "show", "toggle"];
  846. if ("object" == typeof t) return this.each(function() {
  847. var a, r = e(this);
  848. r.data("DateTimePicker") || (a = e.extend(!0, {}, e.fn.datetimepicker.defaults, t), r.data("DateTimePicker", n(r, a)))
  849. });
  850. if ("string" == typeof t) return this.each(function() {
  851. var n = e(this).data("DateTimePicker");
  852. if (!n) throw new Error('bootstrap-datetimepicker("' + t + '") method was called on an element that is not using DateTimePicker');
  853. a = n[t].apply(n, r), i = a === n
  854. }), i || e.inArray(t, o) > -1 ? this : a;
  855. throw new TypeError("Invalid arguments for DateTimePicker: " + t)
  856. }, e.fn.datetimepicker.defaults = {
  857. timeZone: "",
  858. format: !1,
  859. dayViewHeaderFormat: "MMMM YYYY",
  860. extraFormats: !1,
  861. stepping: 1,
  862. minDate: !1,
  863. maxDate: !1,
  864. useCurrent: !0,
  865. collapse: !0,
  866. locale: t.locale(),
  867. defaultDate: !1,
  868. disabledDates: !1,
  869. enabledDates: !1,
  870. icons: {
  871. time: "glyphicon glyphicon-time",
  872. date: "glyphicon glyphicon-calendar",
  873. up: "glyphicon glyphicon-chevron-up",
  874. down: "glyphicon glyphicon-chevron-down",
  875. previous: "glyphicon glyphicon-chevron-left",
  876. next: "glyphicon glyphicon-chevron-right",
  877. today: "glyphicon glyphicon-screenshot",
  878. clear: "glyphicon glyphicon-trash",
  879. close: "glyphicon glyphicon-remove"
  880. },
  881. tooltips: {
  882. today: "Go to today",
  883. clear: "Clear selection",
  884. close: "Close the picker",
  885. selectMonth: "Select Month",
  886. prevMonth: "Previous Month",
  887. nextMonth: "Next Month",
  888. selectYear: "Select Year",
  889. prevYear: "Previous Year",
  890. nextYear: "Next Year",
  891. selectDecade: "Select Decade",
  892. prevDecade: "Previous Decade",
  893. nextDecade: "Next Decade",
  894. prevCentury: "Previous Century",
  895. nextCentury: "Next Century",
  896. pickHour: "Pick Hour",
  897. incrementHour: "Increment Hour",
  898. decrementHour: "Decrement Hour",
  899. pickMinute: "Pick Minute",
  900. incrementMinute: "Increment Minute",
  901. decrementMinute: "Decrement Minute",
  902. pickSecond: "Pick Second",
  903. incrementSecond: "Increment Second",
  904. decrementSecond: "Decrement Second",
  905. togglePeriod: "Toggle Period",
  906. selectTime: "Select Time"
  907. },
  908. useStrict: !1,
  909. sideBySide: !1,
  910. daysOfWeekDisabled: !1,
  911. calendarWeeks: !1,
  912. viewMode: "days",
  913. toolbarPlacement: "default",
  914. showTodayButton: !1,
  915. showClear: !1,
  916. showClose: !1,
  917. widgetPositioning: {
  918. horizontal: "auto",
  919. vertical: "auto"
  920. },
  921. widgetParent: null,
  922. ignoreReadonly: !1,
  923. keepOpen: !1,
  924. focusOnShow: !0,
  925. inline: !1,
  926. keepInvalid: !1,
  927. datepickerInput: ".datepickerinput",
  928. keyBinds: {
  929. up: function(e) {
  930. if (e) {
  931. var t = this.date() || this.getMoment();
  932. e.find(".datepicker").is(":visible") ? this.date(t.clone().subtract(7, "d")) : this.date(t.clone().add(this.stepping(), "m"))
  933. }
  934. },
  935. down: function(e) {
  936. if (e) {
  937. var t = this.date() || this.getMoment();
  938. e.find(".datepicker").is(":visible") ? this.date(t.clone().add(7, "d")) : this.date(t.clone().subtract(this.stepping(), "m"))
  939. } else this.show()
  940. },
  941. "control up": function(e) {
  942. if (e) {
  943. var t = this.date() || this.getMoment();
  944. e.find(".datepicker").is(":visible") ? this.date(t.clone().subtract(1, "y")) : this.date(t.clone().add(1, "h"))
  945. }
  946. },
  947. "control down": function(e) {
  948. if (e) {
  949. var t = this.date() || this.getMoment();
  950. e.find(".datepicker").is(":visible") ? this.date(t.clone().add(1, "y")) : this.date(t.clone().subtract(1, "h"))
  951. }
  952. },
  953. left: function(e) {
  954. if (e) {
  955. var t = this.date() || this.getMoment();
  956. e.find(".datepicker").is(":visible") && this.date(t.clone().subtract(1, "d"))
  957. }
  958. },
  959. right: function(e) {
  960. if (e) {
  961. var t = this.date() || this.getMoment();
  962. e.find(".datepicker").is(":visible") && this.date(t.clone().add(1, "d"))
  963. }
  964. },
  965. pageUp: function(e) {
  966. if (e) {
  967. var t = this.date() || this.getMoment();
  968. e.find(".datepicker").is(":visible") && this.date(t.clone().subtract(1, "M"))
  969. }
  970. },
  971. pageDown: function(e) {
  972. if (e) {
  973. var t = this.date() || this.getMoment();
  974. e.find(".datepicker").is(":visible") && this.date(t.clone().add(1, "M"))
  975. }
  976. },
  977. enter: function() {
  978. this.hide()
  979. },
  980. escape: function() {
  981. this.hide()
  982. },
  983. "control space": function(e) {
  984. e && e.find(".timepicker").is(":visible") && e.find('.btn[data-action="togglePeriod"]').click()
  985. },
  986. t: function() {
  987. this.date(this.getMoment())
  988. },
  989. delete: function() {
  990. this.clear()
  991. }
  992. },
  993. debug: !1,
  994. allowInputToggle: !1,
  995. disabledTimeIntervals: !1,
  996. disabledHours: !1,
  997. enabledHours: !1,
  998. viewDate: !1
  999. }, e.fn.datetimepicker
  1000. });