MCPcopy
hub / github.com/layui/layui / checkValid

Function checkValid

src/modules/laydate.js:1149–1166  ·  view source on GitHub ↗
(dateTime)

Source from the content-addressed store, hash-verified

1147 })(),
1148 //校验日期有效数字
1149 checkValid = function (dateTime) {
1150 if (!dateTime) {
1151 return;
1152 }
1153 if (dateTime.year > LIMIT_YEAR[1])
1154 ((dateTime.year = LIMIT_YEAR[1]), (error = true)); //不能超过20万年
1155 if (dateTime.month > 11) ((dateTime.month = 11), (error = true));
1156 if (dateTime.seconds > 59)
1157 ((dateTime.seconds = 0), dateTime.minutes++, (error = true));
1158 if (dateTime.minutes > 59)
1159 ((dateTime.minutes = 0), dateTime.hours++, (error = true));
1160 if (dateTime.hours > 23) ((dateTime.hours = 0), (error = true));
1161
1162 //计算当前月的最后一天
1163 thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year);
1164 if (dateTime.date > thisMaxDate)
1165 ((dateTime.date = thisMaxDate), (error = true));
1166 },
1167 //获得初始化日期值
1168 initDate = function (dateTime, value, index) {
1169 var startEnd = ['startTime', 'endTime'];

Callers 2

initDateFunction · 0.85
laydate.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected