diff --git a/packages/nc-gui/components/project/spreadsheet/components/EditColumn.vue b/packages/nc-gui/components/project/spreadsheet/components/EditColumn.vue index 03d75d602c..a6f1577f9c 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/EditColumn.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/EditColumn.vue @@ -145,7 +145,13 @@ there are multiple values associated with a cell - + + + diff --git a/packages/nc-gui/components/project/spreadsheet/components/editColumn/DateOptions.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn/DateOptions.vue new file mode 100644 index 0000000000..3be16ef191 --- /dev/null +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn/DateOptions.vue @@ -0,0 +1,38 @@ + + diff --git a/packages/nc-gui/components/project/spreadsheet/components/editableCell/DatePickerCell.vue b/packages/nc-gui/components/project/spreadsheet/components/editableCell/DatePickerCell.vue index 03fbac7738..d98187ac9f 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editableCell/DatePickerCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editableCell/DatePickerCell.vue @@ -18,6 +18,7 @@ import dayjs from 'dayjs' export default { name: 'DatePickerCell', props: { + column: Object, value: [String, Date] }, computed: { @@ -35,10 +36,18 @@ export default { }, date() { if (!this.value || this.localState) { - return this.localState + return this.localState ? dayjs(this.localState).format(this.datepickerMeta.date_format || 'YYYY-MM-DD') : this.localState } return 'Invalid Date' }, + datepickerMeta() { + return { + date_format: 'YYYY-MM-DD', + ...(this.column && this.column.meta + ? this.column.meta + : {}) + } + }, parentListeners() { const $listeners = {} diff --git a/packages/nc-gui/helpers/dateFormatHelper.js b/packages/nc-gui/helpers/dateFormatHelper.js new file mode 100644 index 0000000000..032e44f829 --- /dev/null +++ b/packages/nc-gui/helpers/dateFormatHelper.js @@ -0,0 +1,9 @@ +export const dateFormat = [ + 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', + 'DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', + 'DD MM YYYY', 'MM DD YYYY', 'YYYY MM DD' +] + +export function validateDateFormat(v) { + return dateFormat.includes(v) +} \ No newline at end of file