-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove moment #31
Remove moment #31
Conversation
未考虑 UTC 时间,时区要靠用户自己调整 |
src/DatePicker.tsx
Outdated
} | ||
} else if (mode === DATE) { | ||
if (date.isBefore(minDate, 'day')) { | ||
return minDate.clone(); | ||
if (+date + 24 * 60 * 60 * 1000 <= minDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string + number < Date Object
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
忘了,后边 minDate 也需要个前置 +
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
貌似不转换没关系,Date Object > number
正常、应该支持隐式自动转换
src/DatePicker.tsx
Outdated
} | ||
} else if (mode === DATE) { | ||
if (date.isBefore(minDate, 'day')) { | ||
return minDate.clone(); | ||
if (+date + 24 * 60 * 60 * 1000 <= minDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ONE_DAY = 24 * 60 * 60 * 1000;
代码逻辑看不出什么问题,只是从风格而言,有比较多的隐式转换的地方。 |
此类问题,或者可以让用户通过 data-fns 和 moment 之类解决? const time = moment().utcOffset(8);
<MDatePicker value={time.toDate()} /> |
又查了下,UTC 时间可以不用考虑,跟 local time 主要就是差了个时区,其他没什么 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
顺便把 rmc-picker 也升级掉把
CI failed... |
remove moment.js