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

Wrong date conversion in a specific date #42

Closed
MHKalantarian opened this issue Jan 4, 2021 · 2 comments
Closed

Wrong date conversion in a specific date #42

MHKalantarian opened this issue Jan 4, 2021 · 2 comments
Labels

Comments

@MHKalantarian
Copy link

MHKalantarian commented Jan 4, 2021

Date converted to epoch
1360/08/02 > 372780535866 UNIX
But when I try to reverse this specific date using
new PersianDateFormat("Y/m/d").format(new PersianDate(372780535866 ))
it returns 1360/07/01

@MHKalantarian
Copy link
Author

MHKalantarian commented Jan 16, 2021

This code returns this values and it seems every time a conversion is happening day is getting reduced by 1
Code:

            PersianDate date = new PersianDate();
            date.setShYear(binding.yearNp.getValue());
            date.setShMonth(binding.monthNp.getValue());
            date.setShDay(binding.dayNp.getValue());
            Log.e("Date", binding.yearNp.getValue() + "/" + binding.monthNp.getValue() + "/" + binding.dayNp.getValue());
            Log.e("Date", date.getShYear() + "/" + date.getShMonth() + "/" + date.getShDay());
            Log.e("Date", new PersianDateFormat("Y/m/d").format(new PersianDate(date.getTime())) + " _ " + date.getTime());

Result:

E/Date: 1360/3/8
E/Date: 1360/3/7
E/Date: 1360/03/06 _ 359885553000

@samanzamani
Copy link
Owner

Bug fixed in v1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants