docbrown/app/assets/javascripts/initializers/initializeDateTimeHelpers.js
thejwuscript fea90d2e84
Fix inconsistent published date of Article and Comment (#18412)
* Revise system specs for viewing a comment

* Add system specs for viewing comment date

* Add conditional to SetTimeZone middleware

* Revise comment_date partial

* Refactor viewing a comment system specs

* Add more system specs for viewing a comment

* Fix format of comment date with short year

* Fix edited comment date

* Fix comment date when posting new comments
2022-09-09 14:12:15 -06:00

25 lines
581 B
JavaScript

/* global localizeTimeElements */
'use strict';
function initializeDateHelpers() {
// Date without year: Jul 12
localizeTimeElements(document.querySelectorAll('time.date-no-year'), {
month: 'short',
day: 'numeric',
});
// Full date: Jul 12, 2020
localizeTimeElements(document.querySelectorAll('time.date'), {
year: 'numeric',
month: 'short',
day: 'numeric',
});
// Date with short year: Jul 12 '20
localizeTimeElements(document.querySelectorAll('time.date-short-year'), {
year: '2-digit',
month: 'short',
day: 'numeric',
});
}