Add basic date & time formatters using navigator language (#404)
Adjacent to #400 — while this isn't yet a proper localization pass, at least dates & times will now use the user's browser language/locale settings. When used in Browsertrix, this should ensure dates are formatted more consistently, at least when the user has a locale with a language matching one of the supported languages in Browsertrix set in their browser settings. Also adds tabular numerals in a few places (e.g. lists of dates/times).
This commit is contained in:
+4
-1
@@ -7,6 +7,7 @@ import prettyBytes from "pretty-bytes";
|
||||
import type { ItemType } from "./types";
|
||||
|
||||
import "./components/labeled-field";
|
||||
import { dateTimeFormatter } from "./utils/dateTimeFormatter";
|
||||
|
||||
// ===========================================================================
|
||||
class ItemInfo extends LitElement {
|
||||
@@ -111,7 +112,9 @@ class ItemInfo extends LitElement {
|
||||
</wr-labeled-field>`
|
||||
: nothing}
|
||||
<wr-labeled-field label="Date Loaded" class="column is-2">
|
||||
${item!.ctime ? new Date(item!.ctime).toLocaleString() : nothing}
|
||||
${item!.ctime
|
||||
? dateTimeFormatter.format(new Date(item!.ctime))
|
||||
: nothing}
|
||||
</wr-labeled-field>
|
||||
<wr-labeled-field label="Total Size" class="column is-2">
|
||||
${prettyBytes(Number(item!.totalSize || item!.size || 0))}
|
||||
|
||||
Reference in New Issue
Block a user