From 54fea15a5ac306f0dd33b2e7f92307b20c85a1a3 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 29 Apr 2023 17:58:36 +0800 Subject: [PATCH] fix(nc-gui): timeAgo logic --- packages/nc-gui/utils/dateTimeUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/utils/dateTimeUtils.ts b/packages/nc-gui/utils/dateTimeUtils.ts index 803936ebdb..0ab64555ef 100644 --- a/packages/nc-gui/utils/dateTimeUtils.ts +++ b/packages/nc-gui/utils/dateTimeUtils.ts @@ -1,7 +1,11 @@ import dayjs from 'dayjs' +// show in local time export const timeAgo = (date: any) => { - return dayjs.utc(date).fromNow() + if (date.slice(-1) === 'Z') { + return dayjs(date).fromNow() + } + return dayjs(date).utc(true).local().fromNow() } export const dateFormats = [