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

Some leap year timestamps are not correctly calculated #4

Open
ghost opened this issue Oct 23, 2023 · 1 comment
Open

Some leap year timestamps are not correctly calculated #4

ghost opened this issue Oct 23, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 23, 2023

years 1399 and 1403 are leap years

the timespec seconds value for 1399/12/30 and 1400/01/01 are different which is expected behavior
but same values for 1403/12/30 and 1404/01/01 are the same

minimal reproduction:

let time = ptime::from_persian_date(1399, 11, 30).unwrap().to_timespec().sec;
println!("{}", &time);
let time = ptime::from_persian_date(1400, 0, 1).unwrap().to_timespec().sec;
println!("{}", &time);


let time = ptime::from_persian_date(1403, 11, 30).unwrap().to_timespec().sec;
println!("{}", &time);
let time = ptime::from_persian_date(1404, 0, 1).unwrap().to_timespec().sec;
println!("{}", &time);

output

1616198400
1616284800
1742428800
1742428800

@ghost
Copy link
Author

ghost commented Oct 23, 2023

There is a project fork in my account
https://github.com/FarzadAT/rust-persian-calendar

I fixed the issue but had to change the api to my likings
you could check the resolved code and new tests and maybe merge if you are ok with the new api

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

No branches or pull requests

0 participants