glossy icon indicating copy to clipboard operation
glossy copied to clipboard

GlossyParser.prototype.parseBsdTime uses getUTCFullYear, yet creates the date in local time

Open moll opened this issue 12 years ago • 2 comments

Hey,

GlossyParser.prototype.parseBsdTime uses the new Date constructor passing it the current year in UTC, but new Date causes it then to be interpreted as the local time zone's year.

moll avatar Mar 14 '14 02:03 moll

+1

xegea avatar May 13 '18 14:05 xegea

I call this function as a workaround to save datetime correctly:

var currentDate = convertUTCDateToLocalDate(new Date(Date()));

function convertUTCDateToLocalDate(date) { date = new Date(date); var localOffset = date.getTimezoneOffset() * 60000; var localTime = date.getTime(); date = localTime - localOffset; date = new Date(date); return date; };

xegea avatar May 13 '18 14:05 xegea