The problem of 2124/03/20
Problem: The Gregorian date 2124/03/20 must be 1503/01/01 in the Jalali calendar but this lib returns 1502/12/30.
Checks: The Gregorian date 2025/03/20 must be 1403/12/30 in the Jalali calendar which currently is correct but must be rechecked after fixing the reported problem.
@roozbehp typed in the leap year data from the Iranian calendar authority and put it at: https://github.com/roozbehp/persiancalendar/blob/main/kabise.txt
It would be great if automatic tests could be added based on that data to this project.
Hi, I've checked this:
final g = Gregorian(2124, 3, 20);
final j = g.toJalali();
print('$g == $j');
this will print:
Gregorian(2124, 3, 20, 0, 0, 0, 0) == Jalali(1502, 12, 30, 0, 0, 0, 0)
if you check time.ir site date conversion, it says that it is correct.
time.ir has some issues for this date: please, check the leap year rule and the the test set that Roozbeh provided.
the last line included in the file that you mentioned is
1498* 2119-03-21
so no info about 2124.
with this simple code:
import 'package:shamsi_date/shamsi_date.dart';
void main() {
for (int jy = 1206; jy <= 1498; jy++) {
var j = Jalali(jy);
var jf = j.formatter;
var g = j.toGregorian();
var gf = g.formatter;
var s = StringBuffer();
s.write(jf.yyyy);
if (j.isLeapYear()) {
s.write("*");
}
s.write(" ${gf.yyyy}-${gf.mm}-${gf.dd}");
print(s);
}
}
if you compare the output and the file provided by Roozbeh, you can see that (aprt from ** s in the file, which i will output * s in place of them), the contents are equal.
Ok, thank you for checking the issue. We can close it but, it would be great if some tests could be added based on that data to the project.
Thanks, OK, I will add the tests ...
I've added the tests, please take a look:
Iranian Calendar Authority Test Cases
it is named:
Iranian Calendar Authority Test Cases
I will close the issue, But if you think the tests are not sufficient or you found official information for the years out of the range tested by the test case, please reopen the issue.
many thanks for supplying the test cases :smile: