DataTablesSrc icon indicating copy to clipboard operation
DataTablesSrc copied to clipboard

Feature suggestion: Timezone support for datetime() renderer

Open xJuvi opened this issue 1 year ago • 6 comments

Hey there,

i store all timestamps as unix timestamp in my database. When i display them in a form or other page, they will be displayed in UTC+2 (german summertime). Since a few weeks i doesn't convert the timestamps before i display them with datatables. But all timestamps will be displayed in UTC+0. So the time is two hours in the past.

I tried a look in the renderer source code.....

https://github.com/DataTables/DataTablesSrc/blob/18e89b984e01160631890b326914f3f98bbdf629/js/ext/ext.helpers.js#L43-L68

I think where wo use luxon or moment it was very easy to convert the time object in another timezone. The are several ways possible. As fourth parameter we can add the destination timezone. And if we want, we can also add a fifth parameter as current timezone.

Are there any plans for this? Is it allowed to make a short pull request to add this feature? I really need it. Otherwise the datetime renderer isn't useful for me and i need to write my own one. But my suggested changes are no breaking changes and maybe will help some other people.

Kind regards

xJuvi avatar Aug 07 '24 14:08 xJuvi