Skip to content
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

Merged
merged 9 commits into from
Jul 31, 2017
Merged

Remove moment #31

merged 9 commits into from
Jul 31, 2017

Conversation

warmhug
Copy link
Collaborator

@warmhug warmhug commented Jul 13, 2017

remove moment.js

@warmhug
Copy link
Collaborator Author

warmhug commented Jul 14, 2017

未考虑 UTC 时间,时区要靠用户自己调整

}
} else if (mode === DATE) {
if (date.isBefore(minDate, 'day')) {
return minDate.clone();
if (+date + 24 * 60 * 60 * 1000 <= minDate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string + number < Date Object ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

忘了,后边 minDate 也需要个前置 +

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

貌似不转换没关系,Date Object > number正常、应该支持隐式自动转换

}
} else if (mode === DATE) {
if (date.isBefore(minDate, 'day')) {
return minDate.clone();
if (+date + 24 * 60 * 60 * 1000 <= minDate) {
Copy link
Member

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;

@benjycui
Copy link
Member

代码逻辑看不出什么问题,只是从风格而言,有比较多的隐式转换的地方。

@benjycui
Copy link
Member

未考虑 UTC 时间,时区要靠用户自己调整

此类问题,或者可以让用户通过 data-fns 和 moment 之类解决?

const time = moment().utcOffset(8);
<MDatePicker value={time.toDate()} />

@warmhug
Copy link
Collaborator Author

warmhug commented Jul 14, 2017

又查了下,UTC 时间可以不用考虑,跟 local time 主要就是差了个时区,其他没什么

Copy link
Member

@yiminghe yiminghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

顺便把 rmc-picker 也升级掉把

@benjycui
Copy link
Member

CI failed...

@warmhug warmhug merged commit 6bfad99 into master Jul 31, 2017
@warmhug warmhug deleted the remove_moment branch July 31, 2017 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants