Skip to content

Add PartialTime and PartialDateTime with corresponding with methods. #92

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

Merged
merged 6 commits into from
Aug 15, 2024

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Aug 11, 2024

This continues the work on implementing with methods with the approach from #89 by adding the same type of records to DateTime and Time.

@nekevss nekevss added C-enhancement New feature or request C-api Changes related to the public API labels Aug 11, 2024
@nekevss nekevss added this to the 0.1 Blocking milestone Aug 11, 2024
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I agree with this, but I think the API needs to be discussed.

@nekevss nekevss requested a review from jedel1043 August 12, 2024 01:06
@nekevss nekevss requested a review from jedel1043 August 15, 2024 18:17
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@nekevss nekevss merged commit 51bc30a into main Aug 15, 2024
5 checks passed
@nekevss nekevss deleted the partials-and-with-methods branch August 16, 2024 01:22
nekevss added a commit that referenced this pull request Oct 14, 2024
This PR refactors `TemporalFields` into `CalendarFields`. I'm leaving it
as a draft for now as I want to run plug this into Boa and run some
tests beforehand.

General Context:

This builds on the work from #89 and #92.

With the partials implemented for the `with` methods. The values that
would be provided can now be accounted for. Primarily, the time fields
really didn't need to exist in the `TemporalFields` representation
anymore (along with the TimeZone and offset which will probably be
living on the `PartialZonedDateTime`). Furthermore, the partials were
now handling the `undefined` case of the fields, so the calendar
specific fields no longer needed to be an `Option`. In general, I also
just think that this is a better native representation of the fields
values in comparison to the previous version.

Furthermore, this PR also implements better handling for Era and Month
Codes according to the [Intl era and monthCode
proposal](https://tc39.es/proposal-intl-era-monthcode/#sec-temporal-isvalidmonthecodeforcalendar).

There are a couple points where feedback/bike-shedding would definitely
be appreciated. I think the method names in `calendar_types.rs` are
getting a bit unyielding. I am also a bit worried about introducing the
`CalendarMethods` trait, but I do think it makes the ergonomics around
passing `Date`, `DateTime`, and, eventually, `ZonedDateTime` as a
fallback convenient.

cc: @sffc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-api Changes related to the public API C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants