Content deleted Content added
Removed support for Special:Preferences#mw-prefsection-rendering-dateformat |
Overshot a bit |
||
(9 intermediate revisions by the same user not shown) | |||
Line 35:
* If a property is a function, it is called to retrieve the formatted
* timestamp string. The function must accept one argument, a `Date` object.
*
* If no `options` is specified, the timestamp adheres to the user’s date
* format and timezone preferences.
*/
outputFormats: {
Line 41 ⟶ 44:
* The tooltip provides a more specific timestamp to distinguish
* comments in rapid succession.
*
* See <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#options>.
*/
relative: {
Line 49 ⟶ 54:
* Absolute dates are helpful for more distant dates, so that the user
* doesn’t have to do math in their head.
*
* See <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#date-time_component_options>
* and <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#style_shortcuts>.
*/
// absolute: {
// dateStyle: "long",
// timeStyle: "short",
// },
},
Line 61 ⟶ 69:
* If an element of this array is an object its `type` and `options` may be:
*
* `type` | `options`
* ------------|----------
* `relative` | `Intl.RelativeTimeFormat` options
* `absolute` | `Intl.AbsoluteTimeFormat` options
* `
* `iso8601` | —
*
* See:
* <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#options>
* <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#date-time_component_options>
* <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#style_shortcuts>
*
* If an element of this array is a function, it is called to retrieve the
Line 275 ⟶ 289:
var lang = mw.config.get("wgPageViewLanguage");
var formatter = mw.loader.require("mediawiki.DateFormatter");
switch (fmt.type) {
case "absolute":
var absolute = new Intl.DateTimeFormat(lang, fmt.options);
return
}▼
return formatter.formatTimeAndDate(then);
case "relative":
var relative = new Intl.RelativeTimeFormat(lang, fmt.options); var component = relativeDateComponent(then);
return
return formatter.formatRelativeTimeOrDate(then);
case "iso8601":
return
}
}
Line 310 ⟶ 330:
// Replace the text.
var
▲ });
▲ }
if (text) {
$(elt).text(text);
Line 328 ⟶ 336:
// Register for periodic updates.
var component = relativeDateComponent(then);
$(elt).attr("data-localcomments-unit", component.unit);
}
Line 361 ⟶ 370:
wrapTimestamps();
mw.loader.using("mediawiki.DateFormatter", function () {
LocalComments.wrapTimestamps = wrapTimestamps;
|