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

Calculation problem #118

Closed
lsgmkk opened this issue Jan 6, 2020 · 4 comments
Closed

Calculation problem #118

lsgmkk opened this issue Jan 6, 2020 · 4 comments

Comments

@lsgmkk
Copy link

lsgmkk commented Jan 6, 2020

I used this to calculate HijrahDate, but the result is not the same as the result of DateTime using Android 8.0
For example, if I calculate today's HijrahDate 2020-1-6, the result is 1441/5/10
But the result I calculated using the method provided by 8.0 is 1441/5/11
Below is my code:

@RequiresApi(Build.VERSION_CODES.O)
fun test() {
    var hijrahDate = HijrahDate.now()
    var pattern = org.threeten.bp.format.DateTimeFormatter.ofPattern("MM/dd/yyyy")
    var s = pattern.format(hijrahDate)
    Log.e("TAG", "test 1-------->$s")

    var ofPattern = DateTimeFormatter.ofPattern("MM/dd/yyyy")
    var now = java.time.chrono.HijrahDate.now()
    var format = ofPattern.format(now)
    Log.e("TAG", "test 2--------->$format")
}

Is this what is the reason?

@lsgmkk
Copy link
Author

lsgmkk commented Jan 6, 2020

The result of test 1 is 5/10/1441
The result of test 2 is 5/11/1441

@JakeWharton
Copy link
Owner

This library is just a repackaging of the timezone database for use on Android. Any problems with the timezone database or the ThreeTenBP library itself should be filed on https://github.com/ThreeTen/threetenbp/.

@MenoData
Copy link

MenoData commented Jan 8, 2020

@lsgmkk The threetenBP-library and its wrapper specialized for Android here does NOT support the umalqura-calendar of Saudi-Arabia. I suspect that is what you want. Well, Java-8+ supports it, but ThreetenBP has not backported it. See also this old issue. So the author S. Colebourne is surely aware of the problem but does not managed to solve it for whatever reason.

The library Threeten-Extra is obviously the wrong place to post a new issue because it will not backport anything from standard Java but is just intended as small enhancement.

The best you can do is probably using another library like

  1. msarhan
  2. Time4A (my lib)

@lsgmkk
Copy link
Author

lsgmkk commented Jan 8, 2020 via email

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

3 participants