Add a component for rendering dates
This component uses Luxon to handle date formatting, which is much cleaner than using the JS Date API without an extra library.
This commit is contained in:
parent
59ac4eb0bd
commit
f6b8caa229
@ -16,6 +16,7 @@
|
||||
"axios": "^0.19.2",
|
||||
"core-js": "^3.6.4",
|
||||
"crypto-js": "^4.0.0",
|
||||
"luxon": "^1.24.1",
|
||||
"markdown-it": "^10.0.0",
|
||||
"prismjs": "^1.20.0",
|
||||
"vue": "^2.6.11",
|
||||
|
23
src/components/DateInline.vue
Normal file
23
src/components/DateInline.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<span>
|
||||
{{ datetime.toISODate() }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DateTime } from 'luxon'
|
||||
|
||||
export default {
|
||||
name: 'DateInline',
|
||||
props: ['date'],
|
||||
computed: {
|
||||
datetime () {
|
||||
return DateTime.fromISO(this.date)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
@ -6019,6 +6019,11 @@ lru-cache@^5.1.1:
|
||||
dependencies:
|
||||
yallist "^3.0.2"
|
||||
|
||||
luxon@^1.24.1:
|
||||
version "1.24.1"
|
||||
resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.24.1.tgz#a8383266131ed4eaed4b5f430f96f3695403a52a"
|
||||
integrity sha512-CgnIMKAWT0ghcuWFfCWBnWGOddM0zu6c4wZAWmD0NN7MZTnro0+833DF6tJep+xlxRPg4KtsYEHYLfTMBQKwYg==
|
||||
|
||||
make-dir@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
|
||||
|
Loading…
Reference in New Issue
Block a user