-
Notifications
You must be signed in to change notification settings - Fork 153
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
Should calendar methods like dateFromFields be able to accept calendar-specific options? #1253
Comments
From the user's point of view, the The Julian => Gregorian transition, as well as Feb. 30 1712 of the Swedish calendar, remain exceptions. IMHO one should not define a general option handling mechanism for this sole usage. Personally I used the In a few word: leave the calendar's author the ability to define a (unique) |
Thank you for the comment on #1245 about how the |
Meeting, 14 Jan: We decided to do this. |
I don't think this is an objection, but just for clarity: this means that |
Also note that we cannot do the same for |
Is this limitation really required? Could we apply validation in Temporal core if there's no calendar being called, but delegate to the calendar otherwise?
Do you mean that there will be validation for Also: how concerned should we be that adding new options in Temporal V2 could break existing calendars that happened to use the same name for their options properties? Should we require all custom options to have a common prefix like is done with |
OK, I don't see why not.
Neither — I mean that in many cases we will have to create a new object to pass in to |
OK, this sounds good as long as it's documented. IMHO, anyone who passes an options bag with getters that have side effects deserves to have weird things happen. ;-) |
Instead of creating new objects and copying the options onto them, always pass the options bags directly through to the Calendar method. In the case of dateUntil(), when it is necessary to overwrite the largestUnit option, copy over all own properties of the original options object instead of setting only the largestUnit property. Adds a few validate-and-discard steps where options values would otherwise not be validated. Closes: #1253
Instead of creating new objects and copying the options onto them, always pass the options bags directly through to the Calendar method. In the case of dateUntil(), when it is necessary to overwrite the largestUnit option, copy over all own properties of the original options object instead of setting only the largestUnit property. Adds a few validate-and-discard steps where options values would otherwise not be validated. Closes: #1253
Instead of creating new objects and copying the options onto them, always pass the options bags directly through to the Calendar method. In the case of dateUntil(), when it is necessary to overwrite the largestUnit option, copy over all own properties of the original options object instead of setting only the largestUnit property. Adds a few validate-and-discard steps where options values would otherwise not be validated. Closes: #1253
Instead of creating new objects and copying the options onto them, always pass the options bags directly through to the Calendar method. In the case of dateUntil(), when it is necessary to overwrite the largestUnit option, copy over all own properties of the original options object instead of setting only the largestUnit property. Adds a few validate-and-discard steps where options values would otherwise not be validated. Closes: #1253
Currently, the
options
bag for methods likefrom
andwith
is normalized before the calendar gets ahold of the user's input. This means that calendar developers cannot define custom options. For example, a calendar that spans the Julian=>Gregorian transition can't add an option that offers'earlier' | 'later' | 'reject'
behavior to determine how to handle skipped days.Should we delegate validation and normalization of options bags to the calendar?
This is analogous to #1229 which proposes delegating validation of input bags to calendars.
Ordinarily I'd say punt this low-priority thing until V2, but one challenge with doing so is that if we did that, then there'd be no way for a calendar to choose a different default value for the
overflow
option, because the default is pre-filled to'constrain'
before the calendar is called. We still might want to punt this to V2 (or never!) but we'd need to be OK with fixing the default ofoverflow
forever.The text was updated successfully, but these errors were encountered: