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

Conversion between year units #25

Closed
joeroe opened this issue Nov 13, 2020 · 2 comments
Closed

Conversion between year units #25

joeroe opened this issue Nov 13, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@joeroe
Copy link
Owner

joeroe commented Nov 13, 2020

Adding non-Gregorian calendars complicates the definition and conversion of eras. We need to account for:

  • The differing length of Gregorian vs. non-Gregorian years
  • Differing lengths within an era – leap days etc. (?)
  • Non-alignment of year starts, e.g. 1422 AH is either 2020 or 2021 CE, depending on where in the year we are

I haven't fully worked out how to do this. But some general principles:

  • The scope of this package is years; we should avoid having to explicitly consider dates if at all possible
  • In this context years are not dates. They are a measurement of the period of time elapsed from a particular epoch in a particular unit. They can be converted to dates, but only approximately.
  • It follows from this that 2020 CE is actually "2020 Gregorian years from Year Zero", and that converting it to a non-Gregorian year will probably result in a decimal value.
  • It's okay if conversions between eras are approximate (perhaps issue a warning about this though)
  • It's important that conversions between eras are symmetric
@joeroe joeroe added the enhancement New feature or request label Nov 13, 2020
@joeroe joeroe added this to the v0.3 (CRAN) milestone Nov 13, 2020
joeroe added a commit that referenced this issue Nov 13, 2020
As a starting point to working out how to handle non-Gregorian calendars #25
joeroe added a commit that referenced this issue Jan 25, 2021
To prepare for transformations between units (#25), the unit parameter of an era definition is now represented with the S3 class era_year, which describes not just the name of the unit but its length in solar days.

Incidentally fixes #9.
joeroe added a commit that referenced this issue Jan 26, 2021
Should address #25 pending tests and documentation
@joeroe
Copy link
Owner Author

joeroe commented Jan 26, 2021

4f447ce added the core functionality. To do:

  • Add tests
    • All possible transformations run without error
    • All possible transformations are symmetrical
    • Some specific values for key transformations
    • Invalid transformations throw an error
  • Check & update documentation
    • Functions
    • Readme
    • Vignette

joeroe added a commit that referenced this issue Jan 26, 2021
@joeroe
Copy link
Owner Author

joeroe commented Jan 26, 2021

Updated the documentation in de545c7.

@joeroe joeroe closed this as completed Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant