I have a script that gets a date/time in the the format of:
2017-06-15 21:00
and then converts it to local time and displays as:
Using @James suggestion to use toLocaleString()
$(document).ready(function() {
$('.plg-date > .fabrikElement > div').each(function() {
if($(this).text().length > 0) {
var date = $(this).text();
var newdate = new Date(date + " UTC");
var options = {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
timeZoneName: 'short'
}
$(this).text(newdate.toLocaleString('en-US', options));
}
})
})