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

Use moment to calculate the difference between dates #423

Merged
merged 3 commits into from
Apr 4, 2018

Conversation

calebcauthon
Copy link
Contributor

@calebcauthon calebcauthon commented Mar 29, 2018

Whats New

Screenshots

Updated after suggested changes

image

@@ -1803,7 +1803,7 @@
}

function countDays(start, end) {
return Math.abs(daysFrom1970(start) - daysFrom1970(end)) + 1;
return moment(start).diff(moment(end), 'd') + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add Math.abs, because returning value can be negative;

Copy link
Contributor

Choose a reason for hiding this comment

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

Also you can remove functions daysFrom1970 and toLocalTimestamp, they not required anymore.

@yphoenix
Copy link

yphoenix commented Apr 3, 2018

Looks good to me also.

@holtkamp
Copy link
Collaborator

holtkamp commented Apr 3, 2018

@calebcauthon can you perform the suggestions made by @wakirin, then I will squash and merge...

@calebcauthon
Copy link
Contributor Author

Thanks for the review and suggestions! Changes are made and screenshot updated.

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.

4 participants