Skip to content

Commit

Permalink
ui: improve time detection on InfoCard
Browse files Browse the repository at this point in the history
  • Loading branch information
avakarev committed Nov 26, 2023
1 parent 2c8d8e9 commit 695fd2c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
16 changes: 16 additions & 0 deletions ui/package-lock.json

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

4 changes: 3 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"@coreui/vue": "^4.10.1",
"luxon": "^3.4.4",
"pinia": "^2.1.7",
"s-ago": "^2.2.0",
"tinycolor2": "^1.6.0",
Expand All @@ -28,9 +29,10 @@
"devDependencies": {
"@rushstack/eslint-patch": "^1.6.0",
"@tsconfig/node20": "^20.1.2",
"@types/tinycolor2": "^1.4.6",
"@types/jsdom": "^21.1.6",
"@types/luxon": "^3.3.5",
"@types/node": "^20.10.0",
"@types/tinycolor2": "^1.4.6",
"@vitejs/plugin-vue": "^4.5.0",
"@vue/eslint-config-airbnb": "^7.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/InfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<script lang="ts">
import { defineComponent, type PropType } from 'vue';
import { DateTime } from 'luxon';
import TimeAgo from '@/components/TimeAgo.vue';
export default defineComponent({
Expand All @@ -30,7 +31,7 @@ export default defineComponent({
components: { TimeAgo },
methods: {
isTime(v: unknown): boolean {
return typeof v === 'string' && !Number.isNaN(Date.parse(v));
return typeof v === 'string' && DateTime.fromISO(v).isValid;
},
},
});
Expand Down

0 comments on commit 695fd2c

Please sign in to comment.