Browse Source

fix(nc-gui): copy paste datetime with unknown format

pull/7759/head
Ramesh Mane 9 months ago
parent
commit
c835be96b3
  1. 9
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts
  2. 2
      packages/nocodb-sdk/src/lib/dateTimeHelper.ts

9
packages/nc-gui/composables/useMultiSelect/convertCellData.ts

@ -1,6 +1,6 @@
import dayjs from 'dayjs'
import type { AttachmentType, ColumnType, LinkToAnotherRecordType, SelectOptionsType } from 'nocodb-sdk'
import { UITypes, getDateFormat, populateUniqueFileName, validateDateWithUnknownFormat } from 'nocodb-sdk'
import { UITypes, getDateFormat, getDateTimeFormat, populateUniqueFileName, validateDateWithUnknownFormat } from 'nocodb-sdk'
import type { AppInfo } from '~/composables/useGlobal'
import { isBt, isMm, parseProp } from '#imports'
@ -67,11 +67,8 @@ export default function convertCellData(
return parsedDate.format('YYYY-MM-DD')
}
case UITypes.DateTime: {
const parsedDateTime = dayjs(
value,
`${parseProp(column?.meta)?.date_format ?? 'YYYY-MM-DD'} ${parseProp(column?.meta)?.time_format ?? 'HH:mm'}`,
)
if (!parsedDateTime.isValid()) {
const parsedDateTime = dayjs(value, getDateTimeFormat(value))
if (!(validateDateWithUnknownFormat(value) && parsedDateTime.isValid())) {
if (isMultiple) {
return null
} else {

2
packages/nocodb-sdk/src/lib/dateTimeHelper.ts

@ -64,7 +64,7 @@ export function getDateTimeFormat(v: string) {
}
}
}
return 'YYYY/MM/DD';
return 'YYYY/MM/DD HH:mm';
}
export function parseStringDate(v: string, dateFormat: string) {

Loading…
Cancel
Save