Skip to content

Commit c67e3bc

Browse files
Shorter date column in subscription table (#101)
1 parent 35ac964 commit c67e3bc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/resources/static/js/subscription.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,20 @@ jQuery(document).ready(function () {
257257
};
258258

259259
self.getUTCDate = function (epochtime) {
260-
var d = new Date(0); // The 0 there is the key, which sets the date to the epoch
261-
d.setUTCMilliseconds(epochtime);
262-
return d; // Is now a date (in client time zone)
260+
var date = new Date(epochtime);
261+
var resolvedOptions = Intl.DateTimeFormat().resolvedOptions();
262+
var options = {
263+
year: 'numeric',
264+
month: 'short',
265+
day: 'numeric',
266+
hour: 'numeric',
267+
minute: 'numeric',
268+
second: 'numeric',
269+
hour12: false,
270+
timeZone: resolvedOptions.timeZone,
271+
timeZoneName: 'short'
272+
};
273+
return date.toLocaleDateString(resolvedOptions.locale, options); // Is now a date (in client time zone)
263274
}
264275

265276
self.add_requirement = function (data, event) {

0 commit comments

Comments
 (0)