-
Notifications
You must be signed in to change notification settings - Fork 1
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
Improve date readouts to use locale instead of fixed mdy/dmy behavior #626
Comments
For strings, we should be using For arranging the dropdown menus, we can use |
I've been experimenting with
The outputs are what we could hope for, so I agree, this could work well.
|
Instead of hard-coding an era prefix, set |
1 The basic date readouts:
1B Afterthought: For the BCE/CE pickers, the language can differ between our hardcoded per-language text in While I was going for the more secular version of the BC/AD thing, but this is a UX inconsistency that's always visible. I wonder whether we can use Intl.DateTimeFormat here as well?
2 At this point the
3 The Change Date modal comes with some other baggage that could be jettisoned along with changing it to a select-based UI or accepting only ISO. First cut, adjust this to allow only ISO dates and we can prune out more hand-crafted date string dependencies.
Then see #624 where I will replace the Change Date modal anyway. But this first pass will clean up a bunch of string-juggling stuff, reducing the code by a few paragraphs, and meaning less to adjust in that step. 4 The range UI is Month Day Year which is specific to USA and a few other place. Could those be rearranged depending on whether the given locale uses y/m/d or d/m/y ?
|
@1ec5 Check this out:
See instructions in OpenHistoricalMap/leaflet-ohm-timeslider-v2#11 if you want to test it out. |
…ge picker, date outputs from Intl.DateTimeFormat
…n improvements and UI changes for ISO 8601 UX
Use |
@1ec5 brought up the idea, that the
I should look that over once we get the other large diffs merged in from #624 and #634 and OpenHistoricalMap/leaflet-ohm-timeslider-v2#11
|
In a similar note to the If we give a positive date and a negative date, pass them to If we could join this with something neutral such as a
|
@gregallensworth is this ticket blocked by anything but your time/attention? I'm not sure if you need help figuring out next steps, or if this is something you could finish and close out. |
The pull request that changes the date formats to be locale-specific are in OpenHistoricalMap/leaflet-ohm-timeslider-v2#11 This same pull request addresses three items:
It is that final one (626) which is dicey. The server-side decimaldate written in Pl/PGSQL should also be updated at the same time as this frontend, or else the frontend and backend will be using different math for translating dates which would probably not do well. See #634 and https://github.com/OpenHistoricalMap/DateFunctions-plpgsql |
Ah, got it! I just spoke to Ruben about prioritizing that date functions PG update so we can merge and close out these blocked tickets. |
This PGSQL date function change has been merged and is now live in the data on staging.openhistoricalmap.org. Gregor, if you could go ahead and merge the relevant PRs that depended on that, then we can deploy all to staging, make sure its working, then move to prod and close out! |
I have merged OpenHistoricalMap/leaflet-ohm-timeslider-v2#11 On https://staging.openhistoricalmap.org/ I now see the BC/AD selectors and date readouts adapting to a few randomly-selected locales, which I know we do not have specific programming here. |
Bug description
The Timeslider V2 can display dates as mm/dd/yyyy or dd/mm/yyyy
Which one it chooses depends on your chosen language's
dateformat
setting as discovered in L.Control.OHMTimeSlider.Translations This is eithermdy
ordmy
https://github.com/OpenHistoricalMap/leaflet-ohm-timeslider-v2/blob/dbbda56312a1b33b133d6e691c074b64cb4f8033/leaflet-ohm-timeslider.js#L975-L1109
Having it coded into
this._translations
is troublesome for two reasons:mdy
So even if you have the UI translated through some other means, the dates are still coded this wayCould the UI detect your preferred date format
ymd
ormdy
by testing a string in your locale, rarther than us hardcoding it for each language?Repro Steps
Improvement
Replace
this._translations.dateformat
with something better, still in discussion.I see 13 places where this pre-determined
dateformat
is used:https://github.com/search?q=repo%3AOpenHistoricalMap%2Fleaflet-ohm-timeslider-v2%20dateformat&type=code
dateformat
defined in the 4 languagesdateformat
mentioned in the README about adding new translationsdateformat
is used in a switch or ifdateformat
is mentioned in an error messageThe text was updated successfully, but these errors were encountered: