Add some debug logging.

This commit is contained in:
James Cole 2025-02-15 20:51:43 +01:00
parent 26c4fe36cc
commit 07631eea28
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -30,8 +30,16 @@ function parseToLocalDates() {
"use strict";
$('span.date-time').each(function () {
var date = $(this).data('date');
var obj = moment.utc(date).local();
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log('raw date is "' + date + '"');
console.log('parse to utc() is "' + moment.utc(date).format() + '"');
console.log('parse to zone(Z) "' + moment.parseZone(date).format() + '" (should be the same)');
console.log('browser timezone is ' + timeZone);
var obj = moment.utc(date).local();
console.log('auto convert to timezone is: "' + obj.format() + '"');
console.log('moment.js format is: "'+date_time_js+'"');
$(this).text(obj.format(date_time_js) + ' ('+ timeZone +')');
});
}