-
Notifications
You must be signed in to change notification settings - Fork 158
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
Don't convert custom calendar fields to integers #1053
Conversation
Only the built-in fields (year through nanosecond, and the plural names for Duration) should be converted to integers. Custom calendar fields should not have any type conversion performed on them. Closes: #1045
Codecov Report
@@ Coverage Diff @@
## main #1053 +/- ##
==========================================
+ Coverage 94.29% 94.33% +0.04%
==========================================
Files 18 18
Lines 6675 6694 +19
Branches 999 1000 +1
==========================================
+ Hits 6294 6315 +21
+ Misses 374 372 -2
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
const BUILTIN_FIELDS = new Set([ | ||
'year', | ||
'month', | ||
'day', | ||
'hour', | ||
'minute', | ||
'second', | ||
'millisecond', | ||
'microsecond', | ||
'nanosecond', | ||
'years', | ||
'months', | ||
'weeks', | ||
'days', | ||
'hours', | ||
'minutes', | ||
'seconds', | ||
'milliseconds', | ||
'microseconds', | ||
'nanoseconds' | ||
]); |
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.
Edge case for followup: this doesn't match the spec if calendar.fields
returns one of the builtin fields that don't apply to the object in question.
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 added this question to #1047 for followup, as it seems very similar.
Only the built-in fields (year through nanosecond, and the plural names
for Duration) should be converted to integers. Custom calendar fields
should not have any type conversion performed on them.
Closes: #1045