-
-
Notifications
You must be signed in to change notification settings - Fork 445
Description
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.....
DataTablesSrc/js/ext/ext.helpers.js
Lines 43 to 68 in 18e89b9
function __mldObj (d, format, locale) { | |
var dt; | |
resolveWindowLibs(); | |
if (__moment) { | |
dt = __moment.utc( d, format, locale, true ); | |
if (! dt.isValid()) { | |
return null; | |
} | |
} | |
else if (__luxon) { | |
dt = format && typeof d === 'string' | |
? __luxon.DateTime.fromFormat( d, format ) | |
: __luxon.DateTime.fromISO( d ); | |
if (! dt.isValid) { | |
return null; | |
} | |
dt.setLocale(locale); | |
} | |
else if (! format) { | |
// No format given, must be ISO | |
dt = new Date(d); |
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