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 a clone method for durations, fixes #4078 #4080
Conversation
src/test/moment/duration.js
Outdated
var durationB = durationA.clone(); | ||
durationA.add(5, 'milliseconds'); | ||
assert.equal(durationB.milliseconds(), 5, 'Calling duration.clone() on a duration will create a clone'); | ||
assert.equal(durationA.milliseconds(), 10, 'Calling duration.clone() on a duration will create a clone'); |
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.
It would make more sense to test that durationA.milliseconds()
does not equal durationB.milliseconds()
. That would test that the object had in fact been cloned more explicitly
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.
I agree - I've updated code, along with the original unit-tests I copied this logic from.
Merged in 2847a99 |
[feature] Implement a clone method for durations, fixes #4078
[misc] TS: Add duration.clone(), for #4080
No description provided.