Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace 2-digit years with numerical years everywhere in the frontend #2394

Merged
merged 4 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
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
16 changes: 14 additions & 2 deletions frontend/src/components/orgs-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,14 @@ export class OrgsList extends BtrixElement {
</a>
</btrix-table-cell>
<btrix-table-cell class="p-2">
${this.localize.date(org.created, { dateStyle: "short" })}
${org.created
? html` <btrix-format-date
date=${org.created}
month="2-digit"
day="2-digit"
year="numeric"
></btrix-format-date>`
: none}
</btrix-table-cell>
<btrix-table-cell class="p-2">
${memberCount ? this.localize.number(memberCount) : none}
Expand All @@ -750,7 +757,12 @@ export class OrgsList extends BtrixElement {
</btrix-table-cell>
<btrix-table-cell class="p-2">
${org.lastCrawlFinished
? this.localize.date(org.lastCrawlFinished, { dateStyle: "short" })
? html`<btrix-format-date
date=${org.lastCrawlFinished}
month="2-digit"
day="2-digit"
year="numeric"
></btrix-format-date>`
: none}
</btrix-table-cell>
<btrix-table-cell class="p-1">
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/ui/format-date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class FormatDate extends LitElement {
@property() era?: "narrow" | "short" | "long";

/** The format for displaying the year. */
@property() year?: "numeric" | "2-digit";
// Technically "2-digit" is a valid option here too, but we've chosen not to
// use it, because it's sometimes ambiguous
@property() year?: "numeric";

/** The format for displaying the month. */
@property() month?: "numeric" | "2-digit" | "narrow" | "short" | "long";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/archived-items/archived-item-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class ArchivedItemListItem extends BtrixElement {
.date=${this.item.finished}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
></btrix-format-date>
</sl-tooltip>
</btrix-table-cell>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/features/archived-items/crawl-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class CrawlListItem extends BtrixElement {
date=${crawl.started}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down Expand Up @@ -148,7 +148,7 @@ export class CrawlListItem extends BtrixElement {
date=${crawl.started}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand All @@ -164,7 +164,7 @@ export class CrawlListItem extends BtrixElement {
date=${crawl.finished}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/archived-items/crawl-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class CrawlLogs extends LitElement {
date=${log.timestamp}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
second="2-digit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class SelectBrowserProfile extends BtrixElement {
.date=${profile.modified}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
></btrix-format-date>
</div></div
></sl-option>
Expand All @@ -106,7 +106,7 @@ export class SelectBrowserProfile extends BtrixElement {
.date=${this.selectedProfile.modified}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class CollectionWorkflowList extends BtrixElement {
.date=${crawl.finished}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/crawl-workflows/workflow-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class WorkflowListItem extends BtrixElement {
date="${workflow.lastRun.toString()}"
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down Expand Up @@ -350,7 +350,7 @@ export class WorkflowListItem extends BtrixElement {
date="${workflow.modified}"
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class ArchivedItemDetail extends BtrixElement {
date=${this.item.finished!}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="numeric"
minute="numeric"
time-zone-name="short"
Expand Down Expand Up @@ -778,7 +778,7 @@ export class ArchivedItemDetail extends BtrixElement {
date=${this.item!.started}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="numeric"
minute="numeric"
time-zone-name="short"
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/org/archived-item-detail/ui/qa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export class ArchivedItemDetailQA extends BtrixElement {
date=${run.started}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand All @@ -365,7 +365,7 @@ export class ArchivedItemDetailQA extends BtrixElement {
date=${run.finished}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down Expand Up @@ -433,7 +433,7 @@ export class ArchivedItemDetailQA extends BtrixElement {
date=${runToBeDeleted.started}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ export class ArchivedItemQA extends BtrixElement {
.date=${page.ts}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/org/browser-profiles-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class BrowserProfilesDetail extends BtrixElement {
date=${this.profile.created}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="numeric"
minute="numeric"
time-zone-name="short"
Expand All @@ -136,7 +136,7 @@ export class BrowserProfilesDetail extends BtrixElement {
}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="numeric"
minute="numeric"
time-zone-name="short"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/org/browser-profiles-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export class BrowserProfilesList extends BtrixElement {
date=${data.created}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand All @@ -299,7 +299,7 @@ export class BrowserProfilesList extends BtrixElement {
}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
></btrix-format-date>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/org/collections-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ export class CollectionsList extends BtrixElement {
date=${col.modified}
month="2-digit"
day="2-digit"
year="2-digit"
year="numeric"
></btrix-format-date>
</btrix-table-cell>
<btrix-table-cell class="p-0">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/utils/localize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("Localize", () => {
const localize = new Localize();
localize.setLanguage("es");
expect(localize.date(new Date("2024-01-01T00:00:00.000Z"))).to.equal(
"31/12/23, 19:00",
"31/12/2023, 19:00",
);
});

Expand Down Expand Up @@ -110,7 +110,7 @@ describe("Localize", () => {
it("formats with the current language", () => {
const localize = new Localize("ko");
expect(localize.date(new Date("2024-01-01T00:00:00.000Z"))).to.equal(
"23. 12. 31. 오후 07:00",
"2023. 12. 31. 오후 07:00",
);
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const { getLocale, setLocale } = configureLocalization({
});

const defaultDateOptions: Intl.DateTimeFormatOptions = {
year: "2-digit",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
Expand Down
Loading