I have a datetime2 coming from sql which displays in a template as follows
{{>~formatDateTime(enddate, "dd/MM/yyyy HH:mm")}}
Which calls the following formatDateTime function
function formatDateTime(dateTime, format)***//the datetime that gets passed in here looks like ("2021-08-01T10:00:40")*** {
if (dateTime instanceof Date && dateTime.getFullYear() == 2050) {
return dateTime.format("HH:mm");
}
if (!format) {
format = "dd MMM yyyy";
}
if (!(dateTime instanceof Date)) {
dateTime = new Date(dateTime);
}
return dateTime.format(format);
};
in chrome and other browsers it works fine it gives me the datetime as follows 2021/08/01 10:00:40 as it is in sql but in safari it doesnt give me the same datetime back as in sql it returns 2021/08/01 12:00:40
see the time is different
how can i fix this?