From e7645dc090515ed11aa28e2d2f267034e996ed75 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 25 Nov 2022 13:42:55 +0530 Subject: [PATCH] update date time short format --- src/utils/time/format.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/utils/time/format.ts b/src/utils/time/format.ts index 9f7ebe2e5..be1244728 100644 --- a/src/utils/time/format.ts +++ b/src/utils/time/format.ts @@ -35,6 +35,18 @@ export function formatDate(date: number | Date) { .join(' '); } +export function formatDateTimeShort(date: number | Date) { + const dateTimeFormat = new Intl.DateTimeFormat('en-US', { + month: 'short', + day: 'numeric', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + }); + + return dateTimeFormat.format(date); +} + export function formatTime(date: number | Date) { const timeFormat = new Intl.DateTimeFormat('en-IN', { timeStyle: 'short', @@ -52,10 +64,6 @@ export function formatDateTime(dateTime: number | Date): string { return [formatDate(dateTime), constants.AT, formatTime(dateTime)].join(' '); } -export function formatDateTimeShort(date: number | Date) { - return [formatDateFull(date), formatTime(date)].join(' '); -} - export function formatDateRelative(date: number) { const units = { year: 24 * 60 * 60 * 1000 * 365,