olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.75k stars 818 forks source link

Add locale to date formatter (and date time and time) #4332

Open ksaadDE opened 1 year ago

ksaadDE commented 1 year ago

The current version is used. However, the documentation does not mention if setLocale can be used.

Technically I should be able to do this:

                    column.formatterParams = {
                        inputFormat:"yyyy-MM-ddTHH:ss",
                        outputFormat: "D z", //outputFormat:"dd/MM/yy HH:ss",
                        invalidPlaceholder:"(invalid date)",
                        timezone:"Europe/Berlin",
                        locale:"de-DE", // <--- THIS should call setLocale
                    };

I just need automatic datetime formats per user's locale (e.g. German datetime 01.01.2023 00:12:00) format in Tabulator. I tried to find it in the docs but it is not specified there.

It is unknown if the implementation of Luxon is correct and I can just use "setLocale" for it, either in the initializer for the columns or in the table's init.

See linked issue here: https://github.com/moment/luxon/issues/664#issuecomment-1804529715

I can only link the DateTime Diff because "Date Time" always leads to the anchor formatter-link. Sadly, the link is wrong. But please look above that section here: https://tabulator.info/docs/5.5/format#formatter-datetimediff (or https://tabulator.info/docs/5.5/format#formatter-datetime)

SO seems not be the right place for this mentioning

ksaadDE commented 11 months ago

@olifolkerd can I access the core of Luxon's init somewhere?

olifolkerd commented 9 months ago

Hey @ksaadDE

The formatter params are Tabulator properties, this only exposes certain luxon configuration options, of which it currently does not offer the locale.

I have reclassified this from a but to a feature request as you are asking for this functionality to be made available, and will consider it for a future release.

Please feel free to submit a pull request with the update if you want to see it in faster.

CHeers

Oli :)

ksaadDE commented 9 months ago

Hey @olifolkerd,

reclassified this from a bug to a feature request

I mean it's still a bug as the date is not shown in the right format and there is no way to fix it (yet). Despite Luxon's ability to automatically detect that, as far as I've understood other issue's discuss. Further those settings must be exposed via the already existing API, otherwise we users can't fix it.

Please feel free to submit a pull request with the update if you want to see it in faster.

When I have time I will look into it. Can you link me the locs where you are exposing the certain luxon settings?

Cheers