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

question: how does app changed calendar used based on language #27

Closed
rezad1393 opened this issue Nov 15, 2023 · 5 comments
Closed

question: how does app changed calendar used based on language #27

rezad1393 opened this issue Nov 15, 2023 · 5 comments

Comments

@rezad1393
Copy link

sorry if this is not an issue but this repo doesn't have discussions section so I had to do it this way.

this may sound stupid but I have this app installed and I have put my phone lang to Persian instead of english.

I saw that this causes this app to use Jalali calendar used in Iran instead of Gregorian calendar.
and it does this automatically ( changes dates of call to jalali and back)

what setting is used in this app that does this or is it from android itself that I never saw before ?

@nicorac
Copy link
Owner

nicorac commented Nov 15, 2023

Dates are formatted using the standard Intl.* function available in JS (BCR-GUI is an Ionic WebApp).

The culture to be used for days/months names is the one set in Android "Language" settings.

PS: I'm working on an improvement in datetime formatting management.
I could also include an option to "force" a custom culture instead of the one set in Android...

@rezad1393
Copy link
Author

dont get me wrong I love this feature and adding an option to set it per app would be icing on cake.

I was asking as a noob how this is done, and you say dates are used as Intl.* which to my untrained ears seems to mean that they are saved as universal (like unix time) and then interpreted according to language?

but the app bcr itself uses json (basically JS text) and you use that right?

@nicorac
Copy link
Owner

nicorac commented Nov 15, 2023

Dates are timestamps, the number of seconds (or milliseconds, depending on required precision) elapsed from 1 Jan 1970, aka Unix Epoch time.
This is pretty common in the programming world to avoid issues with timezones, leap years, time interval calculations and so on...

@rezad1393
Copy link
Author

I understand that.

it is just as an Iranian I have never saw an app uses jalali calendar automatically (or even with user setting) in android and I thought that maybe (as I heard about in android 14 adding more locale stuff) maybe I have missed something in android itself, but it seems that as you say it is not android and it it is your app that does the converting.

sigh.

it may have been unintentional right?
you used webapp and the webapp framework ( is that the right word?) just convert date to set language?

whatever it is , thank you I quite like it.

@nicorac
Copy link
Owner

nicorac commented Nov 15, 2023

Intl.* functions for a WebApp are provided by the OS WebView component; on Android it is some kind related to Chrome App.

whatever it is , thank you I quite like it.

👍

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

2 participants