Skip to content

Unset “Daylight Savings Time” flag for Gregorian date input #15

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meighti
Copy link

@meighti meighti commented Jul 12, 2018

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

@183amir
Copy link

183amir commented Jul 12, 2018

Do you think it would be useful to have a test case for this as well?

@meighti
Copy link
Author

meighti commented Jul 12, 2018

Specifically, this command:
jdate '+%Y/%m/%d' -j `jdate '+%Y/%m/%d' -g 1397/01/02`

should give:
1397/01/02

@meighti
Copy link
Author

meighti commented Jul 12, 2018

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.

@183amir
Copy link

183amir commented Jul 12, 2018

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.

@meighti meighti force-pushed the master branch 2 times, most recently from 1e3173a to 4a4ee3a Compare July 13, 2018 19:35
@meighti
Copy link
Author

meighti commented Jul 13, 2018

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! 🤞

@meighti
Copy link
Author

meighti commented Jul 14, 2018

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 the daylight savings time flag is NOT
set and the time zone is set to “UTC”, otherwise
the conversion of a Gregorian date to Jalali form
and vice versa in some cases could be one day off.
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

Successfully merging this pull request may close these issues.

2 participants