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
Feature/implement generic add #1581
Feature/implement generic add #1581
Conversation
@Anshuman71 thank you a lot! |
Can you please help me with this failing test? |
@Anshuman71 sure, I'm working on a review atm, and tests will pass once you address my comments. Please stay put. |
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.
Great and very important work, thank you so much! Please address my comments before we proceed. I didn't check the date math yet, I will do with the second review round.
@Anshuman71 I'm going to push some changes in the PR. I reevaluated how other functions handle incorrect arguments, and now I think |
As a substitue to `add(Object)` in Moment
use object assign instead
Sure, go ahead |
Fix typos, rename arguement and update doc
Tests for NaN or Number values as duration
Remove quarters Update example Update implementation Throws RangeError
244cadc
to
b4b95dd
Compare
- Return Invalid Date if the duration is invalid - Get rid of weeks and milliseconds not present in ISO 8601's duration - Use addMonths - Cleanup code - Cleanup docs
I've pushed some changes. Most notable changes are:
|
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.
Great work!
@kossnocorp thanks for your help in shipping the feature |
You're welcome! |
Implement the add(Object) function from Moment and fix #1427
Add 2 hours, 15 minutes and 30 seconds to 10 July 2014 12:45:00;
var result = add(new Date(2014, 6, 10, 12, 45, 0), { minutes: 15, hours: 2, seconds: 30 });
result: Thu Jul 10 2014 15:00:30
Supports adding
{
hours: number,
years: number,
days: number,
quarters: number,
weeks: number,
months: number,
minutes: number,
seconds: number,
milliseconds: number
}
combined in a single call