PageSourceSearch

https://www.tdd-global.com/static/plugins/laydate/laydate.js

js tdd-global.com collected 2026-09-25 03:14:49 UTC 40,831 bytes, 636 lines download raw bytes

vendor: 17,147 bytes, lines 1-308
1/*! laydate-v5.0.9 日期与时间组件 MIT License  http://www.layui.com/laydate/  By 贤心 */
2;!function () {
3    "use strict";
4    var e = window.layui && layui.define, t = {
5            getPath: function () {
6                var e = document.currentScript ? document.currentScript.src : function () {
7                    for (var e, t = document.scripts, n = t.length - 1, a = n; a > 0; a--) if ("interactive" === t[a].readyState) {
8                        e = t[a].src;
9                        break
10                    }
11                    return e || t[n].src
12                }();
13                return e.substring(0, e.lastIndexOf("/") + 1)
14            }(), getStyle: function (e, t) {
15                var n = e.currentStyle ? e.currentStyle : window.getComputedStyle(e, null);
16                return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](t)
17            }, link: function (e, a, i) {
18                if (n.path) {
19                    var r = document.getElementsByTagName("head")[0], o = document.createElement("link");
20                    "string" == typeof a && (i = a);
21                    var s = (i || e).replace(/\.|\//g, ""), l = "layuicss-" + s, d = 0;
22                    o.rel = "stylesheet", o.href = n.path + e, o.id = l, document.getElementById(l) || r.appendChild(o), "function" == typeof a && !function c() {
23                        return ++d > 80 ? window.console && console.error("laydate.css: Invalid") : void (1989 === parseInt(t.getStyle(document.getElementById(l), "width")) ? a() : setTimeout(c, 100))
24                    }()
25                }
26            }
27        }, n = {
28            v: "5.0.9",
29            config: {},
30            index: window.laydate && window.laydate.v ? 1e5 : 0,
31            path: t.getPath,
32            set: function (e) {
33                var t = this;
34                return t.config = w.extend({}, t.config, e), t
35            },
36            ready: function (a) {
37                var i = "laydate", r = "", o = (e ? "modules/laydate/" : "theme/") + "default/laydate.css?v=" + n.v + r;
38                return e ? layui.addcss(o, a, i) : t.link(o, a, i), this
39            }
40        }, a = function () {
41            var e = this;
42            return {
43                hint: function (t) {
44                    e.hint.call(e, t)
45                }, config: e.config
46            }
47        }, i = "laydate", r = ".layui-laydate", o = "layui-this", s = "laydate-disabled",
48        l = "开始日期超出了结束日期<br>建议重新选择", d = [100, 2e5], c = "layui-laydate-static",
49        m = "layui-laydate-list", u = "laydate-selected", h = "layui-laydate-hint", y = "laydate-day-prev",
50        f = "laydate-day-next", p = "layui-laydate-footer", g = ".laydate-btns-confirm", v = "laydate-time-text",
51        D = ".laydate-btns-time", T = function (e) {
52            var t = this;
53            t.index = ++n.index, t.config = w.extend({}, t.config, n.config, e), n.ready(function () {
54                t.init()
55            })
56        }, w = function (e) {
57            return new C(e)
58        }, C = function (e) {
59            for (var t = 0, n = "object" == typeof e ? [e] : (this.selector = e, document.querySelectorAll(e || null)); t < n.length; t++) this.push(n[t])
60        };
61    C.prototype = [], C.prototype.constructor = C, w.extend = function () {
62        var e = 1, t = arguments, n = function (e, t) {
63            e = e || (t.constructor === Array ? [] : {});
64            for (var a in t) e[a] = t[a] && t[a].constructor === Object ? n(e[a], t[a]) : t[a];
65            return e
66        };
67        for (t[0] = "object" == typeof t[0] ? t[0] : {}; e < t.length; e++) "object" == typeof t[e] && n(t[0], t[e]);
68        return t[0]
69    }, w.ie = function () {
70        var e = navigator.userAgent.toLowerCase();
71        return !!(window.ActiveXObject || "ActiveXObject" in window) && ((e.match(/msie\s(\d+)/) || [])[1] || "11")
72    }(), w.stope = function (e) {
73        e = e || window.event, e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0
74    }, w.each = function (e, t) {
75        var n, a = this;
76        if ("function" != typeof t) return a;
77        if (e = e || [], e.constructor === Object) {
78            for (n in e) if (t.call(e[n], n, e[n])) break
79        } else for (n = 0; n < e.length && !t.call(e[n], n, e[n]); n++) ;
80        return a
81    }, w.digit = function (e, t, n) {
82        var a = "";
83        e = String(e), t = t || 2;
84        for (var i = e.length; i < t; i++) a += "0";
85        return e < Math.pow(10, t) ? a + (0 | e) : e
86    }, w.elem = function (e, t) {
87        var n = document.createElement(e);
88        return w.each(t || {}, function (e, t) {
89            n.setAttribute(e, t)
90        }), n
91    }, C.addStr = function (e, t) {
92        return e = e.replace(/\s+/, " "), t = t.replace(/\s+/, " ").split(" "), w.each(t, function (t, n) {
93            new RegExp("\\b" + n + "\\b").test(e) || (e = e + " " + n)
94        }), e.replace(/^\s|\s$/, "")
95    }, C.removeStr = function (e, t) {
96        return e = e.replace(/\s+/, " "), t = t.replace(/\s+/, " ").split(" "), w.each(t, function (t, n) {
97            var a = new RegExp("\\b" + n + "\\b");
98            a.test(e) && (e = e.replace(a, ""))
99        }), e.replace(/\s+/, " ").replace(/^\s|\s$/, "")
100    }, C.prototype.find = function (e) {
101        var t = this, n = 0, a = [], i = "object" == typeof e;
102        return this.each(function (r, o) {
103            for (var s = i ? [e] : o.querySelectorAll(e || null); n < s.length; n++) a.push(s[n]);
104            t.shift()
105        }), i || (t.selector = (t.selector ? t.selector + " " : "") + e), w.each(a, function (e, n) {
106            t.push(n)
107        }), t
108    }, C.prototype.each = function (e) {
109        return w.each.call(this, this, e)
110    }, C.prototype.addClass = function (e, t) {
111        return this.each(function (n, a) {
112            a.className = C[t ? "removeStr" : "addStr"](a.className, e)
113        })
114    }, C.prototype.removeClass = function (e) {
115        return this.addClass(e, !0)
116    }, C.prototype.hasClass = function (e) {
117        var t = !1;
118        return this.each(function (n, a) {
119            new RegExp("\\b" + e + "\\b").test(a.className) && (t = !0)
120        }), t
121    }, C.prototype.attr = function (e, t) {
122        var n = this;
123        return void 0 === t ? function () {
124            if (n.length > 0) return n[0].getAttribute(e)
125        }() : n.each(function (n, a) {
126            a.setAttribute(e, t)
127        })
128    }, C.prototype.removeAttr = function (e) {
129        return this.each(function (t, n) {
130            n.removeAttribute(e)
131        })
132    }, C.prototype.html = function (e) {
133        return this.each(function (t, n) {
134            n.innerHTML = e
135        })
136    }, C.prototype.val = function (e) {
137        return this.each(function (t, n) {
138            n.value = e
139        })
140    }, C.prototype.append = function (e) {
141        return this.each(function (t, n) {
142            "object" == typeof e ? n.appendChild(e) : n.innerHTML = n.innerHTML + e
143        })
144    }, C.prototype.remove = function (e) {
145        return this.each(function (t, n) {
146            e ? n.removeChild(e) : n.parentNode.removeChild(n)
147        })
148    }, C.prototype.on = function (e, t) {
149        return this.each(function (n, a) {
150            a.attachEvent ? a.attachEvent("on" + e, function (e) {
151                e.target = e.srcElement, t.call(a, e)
152            }) : a.addEventListener(e, t, !1)
153        })
154    }, C.prototype.off = function (e, t) {
155        return this.each(function (n, a) {
156            a.detachEvent ? a.detachEvent("on" + e, t) : a.removeEventListener(e, t, !1)
157        })
158    }, T.isLeapYear = function (e) {
159        return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0
160    }, T.prototype.config = {
161        type: "date",
162        range: !1,
163        format: "yyyy-MM-dd",
164        value: null,
165        min: "1900-1-1",
166        max: "2099-12-31",
167        trigger: "focus",
168        show: !1,
169        showBottom: !0,
170        btns: ["clear", "now", "confirm"],
171        lang: "cn",
172        theme: "default",
173        position: null,
174        calendar: !1,
175        mark: {},
176        zIndex: null,
177        done: null,
178        change: null
179    }, T.prototype.lang = function () {
180        var e = this, t = e.config, n = {
181            cn: {
182                weeks: ["日", "一", "二", "三", "四", "五", "六"],
183                time: ["时", "分", "秒"],
184                timeTips: "选择时间",
185                startTime: "开始时间",
186                endTime: "结束时间",
187                dateTips: "返回日期",
188                month: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
189                tools: {confirm: "确定", clear: "清空", now: "现在"}
190            },
191            en: {
192                weeks: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
193                time: ["Hours", "Minutes", "Seconds"],
194                timeTips: "Select Time",
195                startTime: "Start Time",
196                endTime: "End Time",
197                dateTips: "Select Date",
198                month: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
199                tools: {confirm: "Confirm", clear: "Clear", now: "Now"}
200            },
201            ar: { // Arabic (Arabic)
202                weeks: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"],
203                time: ["ساعة", "دقيقة", "ثانية"],
204                timeTips: "اختيار الوقت",
205                startTime: "وقت البدء",
206                endTime: "وقت الانتهاء",
207                dateTips: "اختيار التاريخ",
208                month: ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"],
209                tools: { confirm: "تأكيد", clear: "مسح", now: "الآن" }
210            },
211            ru: { // Russian (Russian)
212                weeks: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
213                time: ["Часы", "Минуты", "Секунды"],
214                timeTips: "Выберите время",
215                startTime: "Начальное время",
216                endTime: "Конечное время",
217                dateTips: "Выберите дату",
218                month: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"],
219                tools: { confirm: "Подтвердить", clear: "Очистить", now: "Сейчас" }
220            }
221        };
222        return n[t.lang] || n.cn
223    }, T.prototype.init = function () {
224        var e = this, t = e.config, n = "yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s", a = "static" === t.position,
225            i = {year: "yyyy", month: "yyyy-MM", date: "yyyy-MM-dd", time: "HH:mm:ss", datetime: "yyyy-MM-dd HH:mm:ss"};
226        t.elem = w(t.elem), t.eventElem = w(t.eventElem), t.elem[0] && (t.range === !0 && (t.range = "-"), t.format === i.date && (t.format = i[t.type]), e.format = t.format.match(new RegExp(n + "|.", "g")) || [], e.EXP_IF = "", e.EXP_SPLIT = "", w.each(e.format, function (t, a) {
227            var i = new RegExp(n).test(a) ? "\\d{" + function () {
228                return new RegExp(n).test(e.format[0 === t ? t + 1 : t - 1] || "") ? /^yyyy|y$/.test(a) ? 4 : a.length : /^yyyy$/.test(a) ? "1,4" : /^y$/.test(a) ? "1,308" : "1,2"
229            }() + "}" : "\\" + a;
230            e.EXP_IF = e.EXP_IF + i, e.EXP_SPLIT = e.EXP_SPLIT + "(" + i + ")"
231        }), e.EXP_IF = new RegExp("^" + (t.range ? e.EXP_IF + "\\s\\" + t.range + "\\s" + e.EXP_IF : e.EXP_IF) + "$"), e.EXP_SPLIT = new RegExp("^" + e.EXP_SPLIT + "$", ""), e.isInput(t.elem[0]) || "focus" === t.trigger && (t.trigger = "click"), t.elem.attr("lay-key") || (t.elem.attr("lay-key", e.index), t.eventElem.attr("lay-key", e.index)), t.mark = w.extend({}, t.calendar && "cn" === t.lang ? {
232            "0-1-1": "元旦",
233            "0-2-14": "情人",
234            "0-3-8": "妇女",
235            "0-3-12": "植树",
236            "0-4-1": "愚人",
237            "0-5-1": "劳动",
238            "0-5-4": "青年",
239            "0-6-1": "儿童",
240            "0-9-10": "教师",
241            "0-9-18": "国耻",
242            "0-10-1": "国庆",
243            "0-12-25": "圣诞"
244        } : {}, t.mark), w.each(["min", "max"], function (e, n) {
245            var a = [], i = [];
246            if ("number" == typeof t[n]) {
247                var r = t[n], o = (new Date).getTime(), s = 864e5, l = new Date(r ? r < s ? o + r * s : r : o);
248                a = [l.getFullYear(), l.getMonth() + 1, l.getDate()], r < s || (i = [l.getHours(), l.getMinutes(), l.getSeconds()])
249            } else a = (t[n].match(/\d+-\d+-\d+/) || [""])[0].split("-"), i = (t[n].match(/\d+:\d+:\d+/) || [""])[0].split(":");
250            t[n] = {
251                year: 0 | a[0] || (new Date).getFullYear(),
252                month: a[1] ? (0 | a[1]) - 1 : (new Date).getMonth(),
253                date: 0 | a[2] || (new Date).getDate(),
254                hours: 0 | i[0],
255                minutes: 0 | i[1],
256                seconds: 0 | i[2]
257            }
258        }), e.elemID = "layui-laydate" + t.elem.attr("lay-key"), (t.show || a) && e.render(), a || e.events(), t.value && (t.value.constructor === Date ? e.setValue(e.parse(0, e.systemDate(t.value))) : e.setValue(t.value)))
259    }, T.prototype.render = function () {
260        var e = this, t = e.config, n = e.lang(), a = "static" === t.position, i = e.elem = w.elem("div", {
261                id: e.elemID,
262                "class": ["layui-laydate", t.range ? " layui-laydate-range" : "", a ? " " + c : "", t.theme && "default" !== t.theme && !/^#/.test(t.theme) ? " laydate-theme-" + t.theme : ""].join("")
263            }), r = e.elemMain = [], o = e.elemHeader = [], s = e.elemCont = [], l = e.table = [],
264            d = e.footer = w.elem("div", {"class": p});
265        if (t.zIndex && (i.style.zIndex = t.zIndex), w.each(new Array(2), function (e) {
266            if (!t.range && e > 0) return !0;
267            var a = w.elem("div", {"class": "layui-laydate-header"}), i = [function () {
268                    var e = w.elem("i", {"class": "layui-icon laydate-icon laydate-prev-y"});
269                    return e.innerHTML = "&#xe65a;", e
270                }(), function () {
271                    var e = w.elem("i", {"class": "layui-icon laydate-icon laydate-prev-m"});
272                    return e.innerHTML = "&#xe603;", e
273                }(), function () {
274                    var e = w.elem("div", {"class": "laydate-set-ym"}), t = w.elem("span"), n = w.elem("span");
275                    return e.appendChild(t), e.appendChild(n), e
276                }(), function () {
277                    var e = w.elem("i", {"class": "layui-icon laydate-icon laydate-next-m"});
278                    return e.innerHTML = "&#xe602;", e
279                }(), function () {
280                    var e = w.elem("i", {"class": "layui-icon laydate-icon laydate-next-y"});
281                    return e.innerHTML = "&#xe65b;", e
282                }()], d = w.elem("div", {"class": "layui-laydate-content"}), c = w.elem("table"), m = w.elem("thead"),
283                u = w.elem("tr");
284            w.each(i, function (e, t) {
285                a.appendChild(t)
286            }), m.appendChild(u), w.each(new Array(6), function (e) {
287                var t = c.insertRow(0);
288                w.each(new Array(7), function (a) {
289                    if (0 === e) {
290                        var i = w.elem("th");
291                        i.innerHTML = n.weeks[a], u.appendChild(i)
292                    }
293                    t.insertCell(a)
294                })
295            }), c.insertBefore(m, c.children[0]), d.appendChild(c), r[e] = w.elem("div", {"class": "layui-laydate-main laydate-main-list-" + e}), r[e].appendChild(a), r[e].appendChild(d), o.push(i), s.push(d), l.push(c)
296        }), w(d).html(function () {
297            var e = [], i = [];
298            return "datetime" === t.type && e.push('<span lay-type="datetime" class="laydate-btns-time">' + n.timeTips + "</span>"), w.each(t.btns, function (e, r) {
299                var o = n.tools[r] || "btn";
300                t.range && "now" === r || (a && "clear" === r && (o = "cn" === t.lang ? "重置" : "Reset"), i.push('<span lay-type="' + r + '" class="laydate-btns-' + r + '">' + o + "</span>"))
301            }), e.push('<div class="laydate-footer-btns">' + i.join("") + "</div>"), e.join("")
302        }()), w.each(r, function (e, t) {
303            i.appendChild(t)
304        }), t.showBottom && i.appendChild(d), /^#/.test(t.theme)) {
305            var m = w.elem("style"),
306                u = ["#{{id}} .layui-laydate-header{background-color:{{theme}};}", "#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g, e.elemID).replace(/{{theme}}/g, t.theme);
307            "styleSheet" in m ? (m.setAttribute("type", "text/css"), m.styleSheet.cssText = u) : m.innerHTML = u, w(i).addClass("laydate-theme-molv"), i.appendChild(m)
308        }
309        e.remove(T.thisElemDate), a ? t.elem.append(i) : (document.body.appendChild(i), e.position()), e.checkDate().calendar(), e.changeEvent(), T.thisElemDate = e.elemID, "function" == typeof t.ready && t.ready(w.extend({}, t.dateTime, {month: t.dateTime.month + 1}))
310    }, T.prototype.remove = function (e) {
311        var t = this, n = (t.config, w("#" + (e || t.elemID)));
312        return n.hasClass(c) || t.checkDate(function () {
313            n.remove()
314        }), t
315    }, T.prototype.position = function () {
316        var e = this, t = e.config, n = e.bindElem || t.elem[0], a = n.getBoundingClientRect(), i = e.elem.offsetWidth,
317            r = e.elem.offsetHeight, o = function (e) {
318                return e = e ? "scrollLeft" : "scrollTop", document.body[e] | document.documentElement[e]
319            }, s = function (e) {
320                return document.documentElement[e ? "clientWidth" : "clientHeight"]
321            }, l = 5, d = a.left, c = a.bottom;
322        d + i + l > s("width") && (d = s("width") - i - l), c + r + l > s() && (c = a.top > r ? a.top - r : s() - r, c -= 2 * l), t.position && (e.elem.style.position = t.position), e.elem.style.left = d + ("fixed" === t.position ? 0 : o(1)) + "px", e.elem.style.top = c + ("fixed" === t.position ? 0 : o()) + "px"
323    }, T.prototype.hint = function (e) {
324        var t = this, n = (t.config, w.elem("div", {"class": h}));
325        n.innerHTML = e || "", w(t.elem).find("." + h).remove(), t.elem.appendChild(n), clearTimeout(t.hinTimer), t.hinTimer = setTimeout(function () {
326            w(t.elem).find("." + h).remove()
327        }, 3e3)
328    }, T.prototype.getAsYM = function (e, t, n) {
329        return n ? t-- : t++, t < 0 && (t = 11, e--), t > 11 && (t = 0, e++), [e, t]
330    }, T.prototype.systemDate = function (e) {
331        var t = e || new Date;
332        return {
333            year: t.getFullYear(),
334            month: t.getMonth(),
335            date: t.getDate(),
336            hours: e ? e.getHours() : 0,
337            minutes: e ? e.getMinutes() : 0,
338            seconds: e ? e.getSeconds() : 0
339        }
340    }, T.prototype.checkDate = function (e) {
341        var t, a, i = this, r = (new Date, i.config), o = r.dateTime = r.dateTime || i.systemDate(),
342            s = i.bindElem || r.elem[0],
343            l = (i.isInput(s) ? "val" : "html", i.isInput(s) ? s.value : "static" === r.position ? "" : s.innerHTML),
344            c = function (e) {
345                e.year > d[1] && (e.year = d[1], a = !0), e.month > 11 && (e.month = 11, a = !0), e.hours > 23 && (e.hours = 0, a = !0), e.minutes > 59 && (e.minutes = 0, e.hours++, a = !0), e.seconds > 59 && (e.seconds = 0, e.minutes++, a = !0), t = n.getEndDate(e.month + 1, e.year), e.date > t && (e.date = t, a = !0)
346            }, m = function (e, t, n) {
347                var o = ["startTime", "endTime"];
348                t = (t.match(i.EXP_SPLIT) || []).slice(1), n = n || 0, r.range && (i[o[n]] = i[o[n]] || {}), w.each(i.format, function (s, l) {
349                    var c = parseFloat(t[s]);
350                    t[s].length < l.length && (a = !0), /yyyy|y/.test(l) ? (c < d[0] && (c = d[0], a = !0), e.year = c) : /MM|M/.test(l) ? (c < 1 && (c = 1, a = !0), e.month = c - 1) : /dd|d/.test(l) ? (c < 1 && (c = 1, a = !0), e.date = c) : /HH|H/.test(l) ? (c < 1 && (c = 0, a = !0), e.hours = c, r.range && (i[o[n]].hours = c)) : /mm|m/.test(l) ? (c < 1 && (c = 0, a = !0), e.minutes = c, r.range && (i[o[n]].minutes = c)) : /ss|s/.test(l) && (c < 1 && (c = 0, a = !0), e.seconds = c, r.range && (i[o[n]].seconds = c))
351                }), c(e)
352            };
353        return "limit" === e ? (c(o), i) : (l = l || r.value, "string" == typeof l && (l = l.replace(/\s+/g, " ").replace(/^\s|\s$/g, "")), i.startState && !i.endState && (delete i.startState, i.endState = !0), "string" == typeof l && l ? i.EXP_IF.test(l) ? r.range ? (l = l.split(" " + r.range + " "), i.startDate = i.startDate || i.systemDate(), i.endDate = i.endDate || i.systemDate(), r.dateTime = w.extend({}, i.startDate), w.each([i.startDate, i.endDate], function (e, t) {
354            m(t, l[e], e)
355        })) : m(o, l) : (i.hint("日期格式不合法<br>必须遵循下述格式:<br>" + (r.range ? r.format + " " + r.range + " " + r.format : r.format) + "<br>已为你重置"), a = !0) : l && l.constructor === Date ? r.dateTime = i.systemDate(l) : (r.dateTime = i.systemDate(), delete i.startState, delete i.endState, delete i.startDate, delete i.endDate, delete i.startTime, delete i.endTime), c(o), a && l && i.setValue(r.range ? i.endDate ? i.parse() : "" : i.parse()), e && e(), i)
356    }, T.prototype.mark = function (e, t) {
357        var n, a = this, i = a.config;
358        return w.each(i.mark, function (e, a) {
359            var i = e.split("-");
vendor: 7,023 bytes, lines 360-444
360            i[0] != t[0] && 0 != i[0] || i[1] != t[1] && 0 != i[1] || i[2] != t[2] || (n = a || t[2])
361        }), n && e.html('<span class="laydate-day-mark">' + n + "</span>"), a
362    }, T.prototype.limit = function (e, t, n, a) {
363        var i, r = this, o = r.config, l = {}, d = o[n > 41 ? "endDate" : "dateTime"], c = w.extend({}, d, t || {});
364        return w.each({now: c, min: o.min, max: o.max}, function (e, t) {
365            l[e] = r.newDate(w.extend({year: t.year, month: t.month, date: t.date}, function () {
366                var e = {};
367                return w.each(a, function (n, a) {
368                    e[a] = t[a]
369                }), e
370            }())).getTime()
371        }), i = l.now < l.min || l.now > l.max, e && e[i ? "addClass" : "removeClass"](s), i
372    }, T.prototype.calendar = function (e) {
373        var t, a, i, r = this, s = r.config, l = e || s.dateTime, c = new Date, m = r.lang(),
374            u = "date" !== s.type && "datetime" !== s.type, h = e ? 1 : 0, y = w(r.table[h]).find("td"),
375            f = w(r.elemHeader[h][2]).find("span");
376        if (l.year < d[0] && (l.year = d[0], r.hint("最低只能支持到公元" + d[0] + "年")), l.year > d[1] && (l.year = d[1], r.hint("最高只能支持到公元" + d[1] + "年")), r.firstDate || (r.firstDate = w.extend({}, l)), c.setFullYear(l.year, l.month, 1), t = c.getDay(), a = n.getEndDate(l.month || 12, l.year), i = n.getEndDate(l.month + 1, l.year), w.each(y, function (e, n) {
377            var d = [l.year, l.month], c = 0;
378            n = w(n), n.removeAttr("class"), e < t ? (c = a - t + e, n.addClass("laydate-day-prev"), d = r.getAsYM(l.year, l.month, "sub")) : e >= t && e < i + t ? (c = e - t, s.range || c + 1 === l.date && n.addClass(o)) : (c = e - i - t, n.addClass("laydate-day-next"), d = r.getAsYM(l.year, l.month)), d[1]++, d[2] = c + 1, n.attr("lay-ymd", d.join("-")).html(d[2]), r.mark(n, d).limit(n, {
379                year: d[0],
380                month: d[1] - 1,
381                date: d[2]
382            }, e)
383        }), w(f[0]).attr("lay-ym", l.year + "-" + (l.month + 1)), w(f[1]).attr("lay-ym", l.year + "-" + (l.month + 1)), "cn" === s.lang ? (w(f[0]).attr("lay-type", "year").html(l.year + "年"), w(f[1]).attr("lay-type", "month").html(l.month + 1 + "月")) : (w(f[0]).attr("lay-type", "month").html(m.month[l.month]), w(f[1]).attr("lay-type", "year").html(l.year)), u && (s.range && (e ? r.endDate = r.endDate || {
384            year: l.year + ("year" === s.type ? 1 : 0),
385            month: l.month + ("month" === s.type ? 0 : -1)
386        } : r.startDate = r.startDate || {
387            year: l.year,
388            month: l.month
389        }, e && (r.listYM = [[r.startDate.year, r.startDate.month + 1], [r.endDate.year, r.endDate.month + 1]], r.list(s.type, 0).list(s.type, 1), "time" === s.type ? r.setBtnStatus("时间", w.extend({}, r.systemDate(), r.startTime), w.extend({}, r.systemDate(), r.endTime)) : r.setBtnStatus(!0))), s.range || (r.listYM = [[l.year, l.month + 1]], r.list(s.type, 0))), s.range && !e) {
390            var p = r.getAsYM(l.year, l.month);
391            r.calendar(w.extend({}, l, {year: p[0], month: p[1]}))
392        }
393        return s.range || r.limit(w(r.footer).find(g), null, 0, ["hours", "minutes", "seconds"]), s.range && e && !u && r.stampRange(), r
394    }, T.prototype.list = function (e, t) {
395        var n = this, a = n.config, i = a.dateTime, r = n.lang(),
396            l = a.range && "date" !== a.type && "datetime" !== a.type, d = w.elem("ul", {
397                "class": m + " " + {
398                    year: "laydate-year-list",
399                    month: "laydate-month-list",
400                    time: "laydate-time-list"
401                }[e]
402            }), c = n.elemHeader[t], u = w(c[2]).find("span"), h = n.elemCont[t || 0], y = w(h).find("." + m)[0],
403            f = "cn" === a.lang, p = f ? "å¹´" : "", T = n.listYM[t] || {}, C = ["hours", "minutes", "seconds"],
404            x = ["startTime", "endTime"][t];
405        if (T[0] < 1 && (T[0] = 1), "year" === e) {
406            var M, b = M = T[0] - 7;
407            b < 1 && (b = M = 1), w.each(new Array(15), function (e) {
408                var i = w.elem("li", {"lay-ym": M}), r = {year: M};
409                M == T[0] && w(i).addClass(o), i.innerHTML = M + p, d.appendChild(i), M < n.firstDate.year ? (r.month = a.min.month, r.date = a.min.date) : M >= n.firstDate.year && (r.month = a.max.month, r.date = a.max.date), n.limit(w(i), r, t), M++
410            }), w(u[f ? 0 : 1]).attr("lay-ym", M - 8 + "-" + T[1]).html(b + p + " - " + (M - 1 + p))
411        } else if ("month" === e) w.each(new Array(12), function (e) {
412            var i = w.elem("li", {"lay-ym": e}), s = {year: T[0], month: e};
413            e + 1 == T[1] && w(i).addClass(o), i.innerHTML = r.month[e] + (f ? "月" : ""), d.appendChild(i), T[0] < n.firstDate.year ? s.date = a.min.date : T[0] >= n.firstDate.year && (s.date = a.max.date), n.limit(w(i), s, t)
414        }), w(u[f ? 0 : 1]).attr("lay-ym", T[0] + "-" + T[1]).html(T[0] + p); else if ("time" === e) {
415            var E = function () {
416                w(d).find("ol").each(function (e, a) {
417                    w(a).find("li").each(function (a, i) {
418                        n.limit(w(i), [{hours: a}, {hours: n[x].hours, minutes: a}, {
419                            hours: n[x].hours,
420                            minutes: n[x].minutes,
421                            seconds: a
422                        }][e], t, [["hours"], ["hours", "minutes"], ["hours", "minutes", "seconds"]][e])
423                    })
424                }), a.range || n.limit(w(n.footer).find(g), n[x], 0, ["hours", "minutes", "seconds"])
425            };
426            a.range ? n[x] || (n[x] = {
427                hours: 0,
428                minutes: 0,
429                seconds: 0
430            }) : n[x] = i, w.each([24, 60, 60], function (e, t) {
431                var a = w.elem("li"), i = ["<p>" + r.time[e] + "</p><ol>"];
432                w.each(new Array(t), function (t) {
433                    i.push("<li" + (n[x][C[e]] === t ? ' class="' + o + '"' : "") + ">" + w.digit(t, 2) + "</li>")
434                }), a.innerHTML = i.join("") + "</ol>", d.appendChild(a)
435            }), E()
436        }
437        if (y && h.removeChild(y), h.appendChild(d), "year" === e || "month" === e) w(n.elemMain[t]).addClass("laydate-ym-show"), w(d).find("li").on("click", function () {
438            var r = 0 | w(this).attr("lay-ym");
439            if (!w(this).hasClass(s)) {
440                if (0 === t) i[e] = r, l && (n.startDate[e] = r), n.limit(w(n.footer).find(g), null, 0); else if (l) n.endDate[e] = r; else {
441                    var c = "year" === e ? n.getAsYM(r, T[1] - 1, "sub") : n.getAsYM(T[0], r, "sub");
442                    w.extend(i, {year: c[0], month: c[1]})
443                }
444                "year" === a.type || "month" === a.type ? (w(d).find("." + o).removeClass(o), w(this).addClass(o), "month" === a.type && "year" === e && (n.listYM[t][0] = r, l && (n[["startDate", "endDate"][t]].year = r), n.list("month", t))) : (n.checkDate("limit").calendar(
444), n.closeList()), n.setBtnStatus(), a.range || n.done(null, "change"), w(n.footer).find(D).removeClass(s)
445            }
446        }); else {
447            var S = w.elem("span", {"class": v}), k = function () {
448                w(d).find("ol").each(function (e) {
449                    var t = this, a = w(t).find("li");
450                    t.scrollTop = 30 * (n[x][C[e]] - 2), t.scrollTop <= 0 && a.each(function (e, n) {
451                        if (!w(this).hasClass(s)) return t.scrollTop = 30 * (e - 2), !0
452                    })
453                })
454            }, H = w(c[2]).find("." + v);
455            k(), S.innerHTML = a.range ? [r.startTime, r.endTime][t] : r.timeTips, w(n.elemMain[t]).addClass("laydate-time-show"), H[0] && H.remove(), c[2].appendChild(S), w(d).find("ol").each(function (e) {
456                var t = this;
457                w(t).find("li").on("click", function () {
458                    var r = 0 | this.innerHTML;
459                    w(this).hasClass(s) || (a.range ? n[x][C[e]] = r : i[C[e]] = r, w(t).find("." + o).removeClass(o), w(this).addClass(o), E(), k(), (n.endDate || "time" === a.type) && n.done(null, "change"), n.setBtnStatus())
460                })
461            })
462        }
463        return n
464    }, T.prototype.listYM = [], T.prototype.closeList = function () {
465        var e = this;
466        e.config;
467        w.each(e.elemCont, function (t, n) {
468            w(this).find("." + m).remove(), w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")
469        }), w(e.elem).find("." + v).remove()
470    }, T.prototype.setBtnStatus = function (e, t, n) {
471        var a, i = this, r = i.config, o = w(i.footer).find(g), d = r.range && "date" !== r.type && "time" !== r.type;
472        d && (t = t || i.startDate, n = n || i.endDate, a = i.newDate(t).getTime() > i.newDate(n).getTime(), i.limit(null, t) || i.limit(null, n) ? o.addClass(s) : o[a ? "addClass" : "removeClass"](s), e && a && i.hint("string" == typeof e ? l.replace(/日期/g, e) : l))
473    }, T.prototype.parse = function (e, t) {
474        var n = this, a = n.config,
475            i = t || (e ? w.extend({}, n.endDate, n.endTime) : a.range ? w.extend({}, n.startDate, n.startTime) : a.dateTime),
476            r = n.format.concat();
477        return w.each(r, function (e, t) {
478            /yyyy|y/.test(t) ? r[e] = w.digit(i.year, t.length) : /MM|M/.test(t) ? r[e] = w.digit(i.month + 1, t.length) : /dd|d/.test(t) ? r[e] = w.digit(i.date, t.length) : /HH|H/.test(t) ? r[e] = w.digit(i.hours, t.length) : /mm|m/.test(t) ? r[e] = w.digit(i.minutes, t.length) : /ss|s/.test(t) && (r[e] = w.digit(i.seconds, t.length))
479        }), a.range && !e ? r.join("") + " " + a.range + " " + n.parse(1) : r.join("")
480    }, T.prototype.newDate = function (e) {
481        return e = e || {}, new Date(e.year || 1, e.month || 0, e.date || 1, e.hours || 0, e.minutes || 0, e.seconds || 0)
482    }, T.prototype.setValue = function (e) {
483        var t = this, n = t.config, a = t.bindElem || n.elem[0], i = t.isInput(a) ? "val" : "html";
484        return "static" === n.position || w(a)[i](e || ""), this
485    }, T.prototype.stampRange = function () {
486        var e, t, n = this, a = n.config, i = w(n.elem).find("td");
487        if (a.range && !n.endDate && w(n.footer).find(g).addClass(s), n.endDate) return e = n.newDate({
488            year: n.startDate.year,
489            month: n.startDate.month,
490            date: n.startDate.date
491        }).getTime(), t = n.newDate({
492            year: n.endDate.year,
493            month: n.endDate.month,
494            date: n.endDate.date
495        }).getTime(), e > t ? n.hint(l) : void w.each(i, function (a, i) {
496            var r = w(i).attr("lay-ymd").split("-"), s = n.newDate({year: r[0], month: r[1] - 1, date: r[2]}).getTime();
497            w(i).removeClass(u + " " + o), s !== e && s !== t || w(i).addClass(w(i).hasClass(y) || w(i).hasClass(f) ? u : o), s > e && s < t && w(i).addClass(u)
498        })
499    }, T.prototype.done = function (e, t) {
500        var n = this, a = n.config, i = w.extend({}, n.startDate ? w.extend(n.startDate, n.startTime) : a.dateTime),
501            r = w.extend({}, w.extend(n.endDate, n.endTime));
502        return w.each([i, r], function (e, t) {
503            "month" in t && w.extend(t, {month: t.month + 1})
504        }), e = e || [n.parse(), i, r], "function" == typeof a[t || "done"] && a[t || "done"].apply(a, e), n
505    }, T.prototype.choose = function (e) {
506        var t = this, n = t.config, a = n.dateTime, i = w(t.elem).find("td"), r = e.attr("lay-ymd").split("-"),
507            l = function (e) {
508                new Date;
509                e && w.extend(a, r), n.range && (t.startDate ? w.extend(t.startDate, r) : t.startDate = w.extend({}, r, t.startTime), t.startYMD = r)
510            };
511        if (r = {year: 0 | r[0], month: (0 | r[1]) - 1, date: 0 | r[2]}, !e.hasClass(s)) if (n.range) {
512            if (w.each(["startTime", "endTime"], function (e, n) {
513                t[n] = t[n] || {hours: 0, minutes: 0, seconds: 0}
514            }), t.endState) l(), delete t.endState, delete t.endDate, t.startState = !0, i.removeClass(o + " " + u), e.addClass(o); else if (t.startState) {
515                if (e.addClass(o), t.endDate ? w.extend(t.endDate, r) : t.endDate = w.extend({}, r, t.endTime), t.newDate(r).getTime() < t.newDate(t.startYMD).getTime()) {
516                    var d = w.extend({}, t.endDate, {
517                        hours: t.startDate.hours,
518                        minutes: t.startDate.minutes,
519                        seconds: t.startDate.seconds
520                    });
521                    w.extend(t.endDate, t.startDate, {
522                        hours: t.endDate.hours,
523                        minutes: t.endDate.minutes,
524                        seconds: t.endDate.seconds
525                    }), t.startDate = d
526                }
527                n.showBottom || t.done(), t.stampRange(), t.endState = !0, t.done(null, "change")
528            } else e.addClass(o), l(), t.startState = !0;
529            w(t.footer).find(g)[t.endDate ? "removeClass" : "addClass"](s)
530        }
vendor: 5,900 bytes, lines 530-636
530 else "static" === n.position ? (l(!0), t.calendar().done().done(null, "change")) : "date" === n.type ? (l(!0), t.setValue(t.parse()).remove().done()) : "datetime" === n.type && (l(!0), t.calendar().done(null, "change"))
531    }, T.prototype.tool = function (e, t) {
532        var n = this, a = n.config, i = a.dateTime, r = "static" === a.position, o = {
533            datetime: function () {
534                w(e).hasClass(s) || (n.list("time", 0), a.range && n.list("time", 1), w(e).attr("lay-type", "date").html(n.lang().dateTips))
535            }, date: function () {
536                n.closeList(), w(e).attr("lay-type", "datetime").html(n.lang().timeTips)
537            }, clear: function () {
538                n.setValue("").remove(), r && (w.extend(i, n.firstDate), n.calendar()), a.range && (delete n.startState, delete n.endState, delete n.endDate, delete n.startTime, delete n.endTime), n.done(["", {}, {}])
539            }, now: function () {
540                var e = new Date;
541                w.extend(i, n.systemDate(), {
542                    hours: e.getHours(),
543                    minutes: e.getMinutes(),
544                    seconds: e.getSeconds()
545                }), n.setValue(n.parse()).remove(), r && n.calendar(), n.done()
546            }, confirm: function () {
547                if (a.range) {
548                    if (!n.endDate) return n.hint("请先选择日期范围");
549                    if (w(e).hasClass(s)) return n.hint("time" === a.type ? l.replace(/日期/g, "时间") : l)
550                } else if (w(e).hasClass(s)) return n.hint("不在有效日期或时间范围内");
551                n.done(), n.setValue(n.parse()).remove()
552            }
553        };
554        o[t] && o[t]()
555    }, T.prototype.change = function (e) {
556        var t = this, n = t.config, a = n.dateTime, i = n.range && ("year" === n.type || "month" === n.type),
557            r = t.elemCont[e || 0], o = t.listYM[e], s = function (s) {
558                var l = ["startDate", "endDate"][e], d = w(r).find(".laydate-year-list")[0],
559                    c = w(r).find(".laydate-month-list")[0];
560                return d && (o[0] = s ? o[0] - 15 : o[0] + 15, t.list("year", e)), c && (s ? o[0]-- : o[0]++, t.list("month", e)), (d || c) && (w.extend(a, {year: o[0]}), i && (t[l].year = o[0]), n.range || t.done(null, "change"), t.setBtnStatus(), n.range || t.limit(w(t.footer).find(g), {year: o[0]})), d || c
561            };
562        return {
563            prevYear: function () {
564                s("sub") || (a.year--, t.checkDate("limit").calendar(), n.range || t.done(null, "change"))
565            }, prevMonth: function () {
566                var e = t.getAsYM(a.year, a.month, "sub");
567                w.extend(a, {
568                    year: e[0],
569                    month: e[1]
570                }), t.checkDate("limit").calendar(), n.range || t.done(null, "change")
571            }, nextMonth: function () {
572                var e = t.getAsYM(a.year, a.month);
573                w.extend(a, {
574                    year: e[0],
575                    month: e[1]
576                }), t.checkDate("limit").calendar(), n.range || t.done(null, "change")
577            }, nextYear: function () {
578                s() || (a.year++, t.checkDate("limit").calendar(), n.range || t.done(null, "change"))
579            }
580        }
581    }, T.prototype.changeEvent = function () {
582        var e = this;
583        e.config;
584        w(e.elem).on("click", function (e) {
585            w.stope(e)
586        }), w.each(e.elemHeader, function (t, n) {
587            w(n[0]).on("click", function (n) {
588                e.change(t).prevYear()
589            }), w(n[1]).on("click", function (n) {
590                e.change(t).prevMonth()
591            }), w(n[2]).find("span").on("click", function (n) {
592                var a = w(this), i = a.attr("lay-ym"), r = a.attr("lay-type");
593                i && (i = i.split("-"), e.listYM[t] = [0 | i[0], 0 | i[1]], e.list(r, t), w(e.footer).find(D).addClass(s))
594            }), w(n[3]).on("click", function (n) {
595                e.change(t).nextMonth()
596            }), w(n[4]).on("click", function (n) {
597                e.change(t).nextYear()
598            })
599        }), w.each(e.table, function (t, n) {
600            var a = w(n).find("td");
601            a.on("click", function () {
602                e.choose(w(this))
603            })
604        }), w(e.footer).find("span").on("click", function () {
605            var t = w(this).attr("lay-type");
606            e.tool(this, t)
607        })
608    }, T.prototype.isInput = function (e) {
609        return /input|textarea/.test(e.tagName.toLocaleLowerCase())
610    }, T.prototype.events = function () {
611        var e = this, t = e.config, n = function (n, a) {
612            n.on(t.trigger, function () {
613                a && (e.bindElem = this), e.render()
614            })
615        };
616        t.elem[0] && !t.elem[0].eventHandler && (n(t.elem, "bind"), n(t.eventElem), w(document).on("click", function (n) {
617            n.target !== t.elem[0] && n.target !== t.eventElem[0] && n.target !== w(t.closeStop)[0] && e.remove()
618        }).on("keydown", function (t) {
619            13 === t.keyCode && w("#" + e.elemID)[0] && e.elemID === T.thisElem && (t.preventDefault(), w(e.footer).find(g)[0].click())
620        }), w(window).on("resize", function () {
621            return !(!e.elem || !w(r)[0]) && void e.position()
622        }), t.elem[0].eventHandler = !0)
623    }, n.render = function (e) {
624        var t = new T(e);
625        return a.call(t)
626    }, n.getEndDate = function (e, t) {
627        var n = new Date;
628        return n.setFullYear(t || n.getFullYear(), e || n.getMonth() + 1, 1), new Date(n.getTime() - 864e5).getDate()
629    }, window.lay = window.lay || w, e ? (n.ready(), layui.define(function (e) {
630        n.path = layui.cache.dir, e(i, n)
631    })) : "function" == typeof define && define.amd ? define(function () {
632        return n
633    }) : function () {
634        n.ready(), window.laydate = n
635    }()
636}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.