Skip to content

Commit

Permalink
fix date/time default validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Cheng committed Jul 11, 2022
1 parent 8037b76 commit 5e0c8be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vue3-excel-editor",
"email": "apple.6502@gmail.com",
"description": "Vue3 plugin for displaying and editing the array-of-object in Excel style",
"version": "1.0.7",
"version": "1.0.8",
"main": "src/main.js",
"dependencies": {
"@vuepic/vue-datepicker": "^3.3.0",
Expand Down
6 changes: 6 additions & 0 deletions src/VueExcelColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,36 @@ export default {
break
case 'date':
allowKeys = allowKeys || ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-']
/*
if (!validate) validate = (val) => {
if (val === '') return ''
// if (!moment(val, 'YYYY-MM-DD', true).isValid()) return this.$parent.localizedLabel.invalidInputValue
if (!/^\d{4}-\d{2}-\d{2}$/.test(val)) return this.$parent.localizedLabel.invalidInputValue
return ''
}
*/
break
case 'datetime':
allowKeys = allowKeys || ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', ' ', ':']
/*
if (!validate) validate = (val) => {
if (val === '') return ''
// if (!moment(val, 'YY-MM-DD hh:mm', true).isValid()) return this.$parent.localizedLabel.invalidInputValue
if (!/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(val)) return this.$parent.localizedLabel.invalidInputValue
return ''
}
*/
break
case 'datetimesec':
allowKeys = allowKeys || ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', ' ', ':']
/*
if (!validate) validate = (val) => {
if (val === '') return ''
// if (!moment(val, 'YY-MM-DD hh:mm:ss', true).isValid()) return this.$parent.localizedLabel.invalidInputValue
if (!/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(val)) return this.$parent.localizedLabel.invalidInputValue
return ''
}
*/
break
case 'datetick':
allowKeys = allowKeys || ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', ' ', ':']
Expand Down

0 comments on commit 5e0c8be

Please sign in to comment.