chore(laydate): 优化部分提示

pull/2742/head
贤心 2025-05-26 23:52:36 +08:00
parent 26989d5830
commit de46f23b06
1 changed files with 10 additions and 8 deletions

View File

@ -201,11 +201,12 @@
selectTime: '选择时间', selectTime: '选择时间',
startTime: '开始时间', startTime: '开始时间',
endTime: '结束时间', endTime: '结束时间',
selectDate: '返回日期', selectDate: '选择日期',
tools: { tools: {
confirm: '确定', confirm: '确定',
clear: '清空', clear: '清空',
now: '现在' now: '现在',
reset: '重置'
}, },
timeout: '结束时间不能早于开始时间<br>请重新选择', timeout: '结束时间不能早于开始时间<br>请重新选择',
invalidDate: '不在有效日期或时间范围内', invalidDate: '不在有效日期或时间范围内',
@ -223,7 +224,8 @@
tools: { tools: {
confirm: 'Confirm', confirm: 'Confirm',
clear: 'Clear', clear: 'Clear',
now: 'Now' now: 'Now',
reset: 'Reset'
}, },
timeout: 'End time cannot be less than start Time<br>Please re-select', timeout: 'End time cannot be less than start Time<br>Please re-select',
invalidDate: 'Invalid date', invalidDate: 'Invalid date',
@ -594,8 +596,10 @@
lay.each(options.btns, function(i, item){ lay.each(options.btns, function(i, item){
var title = lang.tools[item] || 'btn'; var title = lang.tools[item] || 'btn';
if(options.range && item === 'now') return; if (options.range && item === 'now') return;
if(isStatic && item === 'clear') title = options.lang === 'cn' ? '重置' : 'Reset'; if (isStatic && item === 'clear') {
title = lang.tools.reset;
}
btns.push('<span lay-type="'+ item +'" class="laydate-btns-'+ item +'">'+ title +'</span>'); btns.push('<span lay-type="'+ item +'" class="laydate-btns-'+ item +'">'+ title +'</span>');
}); });
html.push('<div class="laydate-footer-btns">'+ btns.join('') +'</div>'); html.push('<div class="laydate-footer-btns">'+ btns.join('') +'</div>');
@ -2388,9 +2392,7 @@
? that.startTime && that.endTime && that.newDate(that.startTime) > that.newDate(that.endTime) ? that.startTime && that.endTime && that.newDate(that.startTime) > that.newDate(that.endTime)
: that.startDate && that.endDate && that.newDate(lay.extend({},that.startDate, that.startTime || {})) > that.newDate(lay.extend({},that.endDate, that.endTime || {})); : that.startDate && that.endDate && that.newDate(lay.extend({},that.startDate, that.startTime || {})) > that.newDate(lay.extend({},that.endDate, that.endTime || {}));
return isTimeout return that.hint(isTimeout ? lang.timeout : lang.invalidDate);
? that.hint(options.type === 'time' ? lang.timeout.replace(/日期/g, '时间') : lang.timeout)
: that.hint(lang.invalidDate);
} }
} else { } else {
if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDate); if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDate);