Skip to content

Commit

Permalink
fix: 修改timeHelper边界值处理 (#2225)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhang Rui <zhangrui@growingio.com>
  • Loading branch information
zhuzilv and Zhang Rui committed Jan 16, 2024
1 parent ffc13ca commit a053547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
15 changes: 5 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
//eslint -----settings start-----
"eslint.packageManager": "yarn",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
//eslint -----settings end-----
//prettier -----settings start-----
"prettier.useEditorConfig": false,
Expand Down Expand Up @@ -52,6 +47,6 @@
"sugarss",
"svelte"
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsdk": "node_modules/typescript/lib"
//stylelint -----settings end-----
}
}
3 changes: 3 additions & 0 deletions src/utils/timeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@ export const exportZonedDateToDate = (date: any, format?: string) => {
.format()
.split('T');

if (arr?.[0] === 'Invalid date') {
return date;
}
return new Date(moment(`${arr[0]} ${arr[1].substring(0, 8)}`).format(format || 'yyyy-MM-DD HH:mm:ss'));
};

0 comments on commit a053547

Please sign in to comment.