FIX: infers time from tz creator to ensure day shown is the one expected

This commit is contained in:
Joffrey JAFFEUX
2018-07-16 01:04:50 +02:00
committed by GitHub
parent f3b17b92b7
commit c580a39d49
2 changed files with 37 additions and 22 deletions

View File

@ -11,7 +11,10 @@
clearTimeout(this.timeout);
}
var relativeTime = moment.utc(options.date + " " + options.time, "YYYY-MM-DD HH:mm");
var relativeTime = moment.utc(
options.date + " " + options.time,
"YYYY-MM-DD HH:mm"
);
if (options.recurring && relativeTime < moment().utc()) {
var parts = options.recurring.split(".");
@ -24,7 +27,7 @@
}
var previews = options.timezones.split("|").map(function(timezone) {
var dateTime = relativeTime.tz(timezone).format(options.format);
var dateTime = relativeTime.tz(timezone).format("LLL");
var timezoneParts = _formatTimezone(timezone);
if (dateTime.match(/TZ/)) {
@ -43,10 +46,13 @@
var html = "<span>";
html += "<i class='fa fa-globe d-icon d-icon-globe'></i>";
html += relativeTime.replace("TZ", _formatTimezone(moment.tz.guess()).join(": "));
html += relativeTime.replace(
"TZ",
_formatTimezone(moment.tz.guess()).join(": ")
);
html += "</span>";
var joinedPreviews = previews.join("\n");
var joinedPreviews = previews.join("");
$element
.html(html)