docbrown/app/assets/javascripts/utilities/getLocalTime.js
Jess Lee ce082da041 Display Sidebar & Local Time For Events (#438)
* show timestamp in local time

* Implement initializeTimeFixer

* Add Misc work WIP

* add local time to calendar event

* add local dates

* update localtime for calendar event

* show timestamp in local time

* Implement initializeTimeFixer

* Add Misc work WIP

* add local time to calendar event

* add local dates

* update localtime for calendar event

* return if no utc times on page

* add events sidebar

* only show 3 events on sidebar

* Change wording on events header

They won't all be streams
2018-06-19 10:51:20 -04:00

15 lines
409 B
JavaScript

function updateLocalTime(times) {
function convertUtcTime(timestamp) {
var time = new Date(timestamp);
var options = {
hour: 'numeric',
minute: 'numeric',
};
time = new Intl.DateTimeFormat('en-US', options).format(time);
return time;
}
for (var i = 0; i < times.length; i++) {
localTime = convertUtcTime(times[i].innerHTML);
times[i].innerHTML = localTime;
}
}