Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion static/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ function doneLoading (selector) {
// Other goodies

function formatDate (dateString) {
return (new Date(dateString + ':00')).toLocaleString(
// Replaces the first instance of a space,
// and replace with "T" to fit ISO 8601,
// which all modern browsers support
// Example: YYYY-MM-DD HH:MM:SS-TZ:tz --> YYYY-MM-DDTHH:MM:SS-TZ:tz
// Note: TZ:tz is Hour and Minutes of Time Zone
dateString = `${dateString}:00`.replace(' ', 'T');

return (new Date(dateString)).toLocaleString(
localizer.locale || 'en-us',
{ month: 'long', day: 'numeric', year: 'numeric' }
);
Expand Down