-
Notifications
You must be signed in to change notification settings - Fork 26
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
Replacing some utils for date-fns functions #17
Replacing some utils for date-fns functions #17
Conversation
This is looking great. Thanks for the work! |
Thanks, @mkartchner994. I didn't replace them because they return different values, probably because dateFns.differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31)) // returns 7
// the functions have different signatures, but that's not a problem
monthDiff(new Date(2014, 0, 31), new Date(2014, 8, 1)) // returns 8 |
@arthurdenner Ah, I see. Is that the same for the |
I didn't see this function! And no, |
@@ -57,7 +58,7 @@ function noop() {} | |||
export function subtractMonth({ calendars, offset, minDate }) { | |||
if (offset > 1 && minDate) { | |||
let { firstDayOfMonth } = calendars[0]; | |||
let diffInMonths = monthDiff(minDate, firstDayOfMonth); | |||
let diffInMonths = differenceInCalendarMonths(firstDayOfMonth, 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.
While monthDiff
had the signature (earlierDate, laterDate), differenceInCalendarMonths has the opposite.
@@ -77,7 +78,7 @@ export function subtractMonth({ calendars, offset, minDate }) { | |||
export function addMonth({ calendars, offset, maxDate }) { | |||
if (offset > 1 && maxDate) { | |||
let { lastDayOfMonth } = calendars[calendars.length - 1]; | |||
let diffInMonths = monthDiff(lastDayOfMonth, maxDate); | |||
let diffInMonths = differenceInCalendarMonths(maxDate, lastDayOfMonth); |
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.
Same as here: c6023c9#r180536919
@arthurdenner I think I have decided after all that I will do some work on that tonight or tomorrow and then let you know when I cut that release. Also, I would like recognize your work based on the "All Contributors" specification - https://github.com/kentcdodds/all-contributors. If that is alright with you, another pull request with that would be great - should just be able to run the Thanks again! |
Thanks, @mkartchner994. ❤️ Feel free to add me on the contributors list, I tried to run I closed #14 and you probably want to close #10. I'll open a PR to solve #5 if that's okay. |
@arthurdenner v2.0.1 has bee published. Thanks for your work on this. I have also added you to the contributors list 👍 |
As suggested on #10 and #14, this PR aims to replace some functions on the
utils
module for date-fns equivalents. The following were replaced:new Date()
;