I want to create a column containing dates. I want the column to be sortable (by date) and I want the dates displayed in the column to be human-readable and localized to the browsers locale.
My idea was to separate the visible text/label (localized date string produced by
Date.toLocaleString()
of a cell from its value (for example a Unix timestamp to allow for easy, locale-independent sorting.
For example, say I want to have a cell representing January 31, 2018 @ 0:00 UTC. This would correspond to the Unix timestamp
151735680000
which should be the value of the cell used for sorting. Now, since Unix timestamps are not very comprehensible for humans, I would like the displayed text/label to be 31.1.2018, 01:00:00 because that is the return value of
Date.toLocaleString()
for my locale (UTC+1).
Is it possible to create cells that have a label that is different from its value?
I appreciate any help you can provide.