-
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
How should calendars expose calendar-specific date and time properties? #291
Comments
Do we have a sense of how how finite this set is? If it's just a few things, could we keep adding them as getters to Temporal.Date.prototype? |
why use getters instead of methods? |
I think we need to come up with a list of things that are intrinsic to a date/datetime and things that are related calendaric information. For example: The month number is intrinsic to the date. Whether the date is in a LeapYear is purely calendaric. I suggest we think about moving purely calendaric information to the calendar objects and only have intrinsic date information accessible directly from the core object. See #290 for more details |
Could we spec some kind of forwarding mechanism? Like, you call |
Relevant JSR-310 design document found by following links from Rust (thanks @jasonwilliams!): https://github.com/ThreeTen/threeten/wiki/Multi-calendar-system |
From 2020-02-19 Temporal call: calendar-specific properties should be accessor getters on the Temporal [Date][Time] objects. These getters should have behavior roughly equivalent to: get foo(...args) {
return this.calendar.foo?.(this, ...args);
} In the spec, the getter should access the string property There should be built-in getters following this pattern for all properties of the full ISO calendar in 262; conforming 402 implementations should add additional properties required by 402 calendars. Custom calendars are welcome to modify Temporal.prototype to add conforming getters corresponding to any additional fields they need. Due to the conclusion in in #290, |
Examples of such properties:
I suggested the following possible change, creating a new object for accessing these properties (name bikeshedding aside):
The text was updated successfully, but these errors were encountered: