Open meighti opened 6 years ago
Do you think it would be useful to have a test case for this as well?
Specifically, this command: jdate '+%Y/%m/%d' -j `jdate '+%Y/%m/%d' -g 1397/01/02`
should give: 1397/01/02
It is easy to write a simple test in bash , like the e.g. I mentioned in previous comment.
Also in my opinion, it would have been safe to set:
g.tm_hour = 12;
to avoid any DST flag issues.
I understand. I was suggesting to add a test in the test suite of the library but I cannot find any set of tests. There are only some commands to help test the library manually.
Amended my first commit, since further examination showed that contrary to my initial assumption, that one-liner didn't fix the issue. So I had to make a more conservative set of changes, in order to be completely sure that the amended solution gives a correct answer. Hopefully it is now fixed! :crossed_fingers:
As for 183amir's suggestion of having a test suite, I can only say at the moment that it would be welcomed if anybody has the time and desire to write one.
Make sure “Daylight Savings Time” flag is NOT set, otherwise the conversion of a gregorian date to jalali form would be one day off.
As a test try this command: jdate '+%Y/%m/%d' -j 2018/03/22
The result should be: 1397/01/02