From 4c4d2d325a18da60bd34a77bdca813908f66e47c Mon Sep 17 00:00:00 2001 From: GITNE Date: Sun, 17 Feb 2019 14:03:41 +0100 Subject: [PATCH] Render locale specific time stamp --- src/component/AttributionComponent.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/component/AttributionComponent.ts b/src/component/AttributionComponent.ts index 20efa9fd5..dc4af51fa 100644 --- a/src/component/AttributionComponent.ts +++ b/src/component/AttributionComponent.ts @@ -61,12 +61,8 @@ export class AttributionComponent extends Component { const imageBy: string = compact ? `${username}` : `image by ${username}`; const imageByContent: vd.VNode = vd.h("div.AttributionUsername", { textContent: imageBy }, []); - const date: string[] = new Date(capturedAt).toDateString().split(" "); - const formatted: string = (date.length > 3 ? - compact ? - [date[3]] : - [date[1], date[2] + ",", date[3]] : - date).join(" "); + const date: Date = new Date(capturedAt); + const formatted: string = compact ? date.toLocaleDateString() : date.toLocaleString(); const dateContent: vd.VNode = vd.h("div.AttributionDate", { textContent: formatted }, []); @@ -80,7 +76,7 @@ export class AttributionComponent extends Component { return vd.h("div.AttributionContainer" + compactClass, {}, [mapillaryLink, imageLink]); } - } +} ComponentService.register(AttributionComponent); export default AttributionComponent;