Browse Source

fix(nc-gui): incorrect regex for testing YYYY-MM-DD HH:mm

pull/5719/head
Wing-Kam Wong 2 years ago
parent
commit
0f814e57a3
  1. 2
      packages/nc-gui/utils/dateTimeUtils.ts

2
packages/nc-gui/utils/dateTimeUtils.ts

@ -1,7 +1,7 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
export const timeAgo = (date: any) => { export const timeAgo = (date: any) => {
if (/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(date)) { if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(date)) {
// if there is no timezone info, consider as UTC // if there is no timezone info, consider as UTC
// e.g. 2023-01-01 08:00:00 (MySQL) // e.g. 2023-01-01 08:00:00 (MySQL)
date += '+00:00' date += '+00:00'

Loading…
Cancel
Save