Skip to content

Add calendar consts for calendar construction#541

Merged
Manishearth merged 3 commits intomainfrom
const-calendars
Sep 8, 2025
Merged

Add calendar consts for calendar construction#541
Manishearth merged 3 commits intomainfrom
const-calendars

Conversation

@nekevss
Copy link
Copy Markdown
Member

@nekevss nekevss commented Sep 6, 2025

This is primarily meant to cleanup the general API.

Previously, when using temporal_rs in Rust for non ISO calendars, you would have to use something like the below.

let date = PlainDate::try_new(2025, 5, 6, Calendar::new(AnyCalendarKind::Japanese));

Now, this is hopefully a bit more streamlined.

let date = PlainDate::try_new(2025, 5, 6, Calendar::JAPANESE)

Alternatively, we could take either AnyCalendarKind directly or a temporal_rs specific enum. My one hesitation about AnyCalendarKind is that it feels like an implementation detail / potential power user API leaking out into a general usage API. Definitely open to suggestions or other thoughts on the matter.

@nekevss nekevss requested a review from Manishearth September 7, 2025 05:14
@Manishearth Manishearth merged commit 14e4112 into main Sep 8, 2025
8 checks passed
@Manishearth Manishearth deleted the const-calendars branch September 8, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants