DataTables / DataTables/DataTablesSrc

Feature suggestion: Timezone support for datetime() renderer

Open
#289 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
801
Forks
440
PR merge metrics
No merged PRs in 30d

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.....

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with js/ext/ext.helpers.js around the linked datetime renderer. Read how the renderer currently uses its date-time dependency and determine how an optional destination, and possibly current, timezone should be represented without changing existing calls. Done means the renderer can apply the requested timezone while preserving current behavior when no timezone is supplied.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.