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

Year zero problem #4

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

Year zero problem #4

joeroe opened this issue Nov 9, 2020 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@joeroe
Copy link
Owner

joeroe commented Nov 9, 2020

When converting between CE-based and BP-based eras, yr_transform() does not account for the absence of a year zero.

library("era")
yr_transform(yr(10000, "BP"), era("BCE"))
#> # BCE years <yr[1]>:
#> [1] 8051
#> # Era: Before Common Era (BCE): calendar years, counted backwards from 1

OxCal is good at this kind of thing.

@joeroe
Copy link
Owner Author

joeroe commented Jan 29, 2021

This is still a problem, e.g.:

a <- yr(10, "BC")
b <- yr(10, "CE")
b - yr_transform(a, "CE")
#> # CE years <yr[1]>:
#> [1] 20
#> # Era: Common Era (CE): Gregorian years (365.2425 days), counted forwards from 0

Redefining era epochs using an epoch that has a year 0 (e.g. b2k) might help?

@joeroe joeroe reopened this Jan 29, 2021
@joeroe joeroe modified the milestones: 0.3.0, 1.0.0, 0.4.0 Feb 7, 2021
joeroe added a commit that referenced this issue Mar 8, 2022
The "year zero problem" again... #4
@joeroe
Copy link
Owner Author

joeroe commented Mar 8, 2022

Redefining epochs in a system without a year 0 is a good solution, but b2k introduces the complication of it now being counted backwards instead of forwards. So instead we'll stick with Gregorian years, but using astronomical numbering, i.e. there is a year zero.

This means the epoch of CE is now 0 (i.e. the start of 1 CE was one year after the start of 0 CE) and the epoch of BCE is now 1 (i.e. the start of 1 BCE was one year before the start of 1 CE). Definitions of epochs derived from a (fractional) CE year, e.g. Hijri years, also had to be adjusted.

This seems to make things consistent across the board. I've also added a test to try and catch these annoying off-by-one issues in era definition in future.

@joeroe joeroe closed this as completed Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant