Skip to content
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

WIP: Cookbook example showing custom calendar proof of concept (without custom calendar object) #2906

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ptomato
Copy link
Collaborator

@ptomato ptomato commented Jun 26, 2024

This is an example of how to approach implementing a custom calendar, after Temporal.Calendar objects are removed.

It's an implementation of a Nepali calendar (described by @kabaros in #2854 (comment)) based on the implementation linked in that comment, as well as the implementation that was based on.

I used inheritance in this example because in this case that's slightly less code to write, but inheritance also makes some operations legal that maybe shouldn't be. (Like, Temporal.PlainDateTime.from(nepaliPlainDate)) So it might be better to switch to composition.

I'd also like to write a similar example about Hijri dates with manual adjustment (described in #2854 (comment)) but it was easier to do the proof of concept with Nepali calendar first, since there was already an implementation to copy from. I'll be in contact with @khawarizmus about this.

Draft; needs some cleanup, and a cookbook page.

@ptomato ptomato marked this pull request as draft June 26, 2024 21:27
@kabaros
Copy link

kabaros commented Jun 27, 2024

thanks @ptomato - this is very helpful (and re-assuring).

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.

None yet

2 participants