✨ feat(码单管理日期优化):

This commit is contained in:
2023-01-11 11:19:14 +08:00
parent af03e5fdd3
commit e8f050bcbb
3 changed files with 24 additions and 12 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ const TimePicker = (props: Props) => {
const handTime = (e) => {
const { start, end } = e.value
// 如果选的是同一天的日期, end 自动加一天
if (!end) {
// 如果选的是同一天的日期, end 自动加一天
// 判断如果没选下一天的时候
e.value.end = `${dayjs(new Date(start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
}
@@ -35,7 +35,7 @@ const TimePicker = (props: Props) => {
setTime(e)
}
const currentDate = useMemo(() => {
return (!start && !end) ? null : { start, end }
return (!start && !end) ? { start: `${dayjs(new Date()).format('YYYY-MM-DD')} 00:00:00`, end } : { start, end }
}, [props])
// 由于小程序的bug,部分ios和安卓显示时间的时候会有问题,原因是格式化时有`-`这个横杠
return (