Add date-fns, remove moment (#35)
This commit is contained in:
parent
9d44c90de6
commit
3c65f836e3
|
@ -17,7 +17,7 @@
|
|||
"auth0-js": "^9.7.3",
|
||||
"axios": "^0.19.0",
|
||||
"core-js": "^3.3.2",
|
||||
"moment": "^2.18.1",
|
||||
"date-fns": "^2.8.1",
|
||||
"vue": "^2.5.15",
|
||||
"vue-material": "^1.0.0-beta-11",
|
||||
"vue-router": "^3.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { computed, createComponent, createElement, onBeforeUnmount, onMounted, ref } from '@vue/composition-api'
|
||||
import moment from 'moment'
|
||||
import { format, formatDistance } from 'date-fns'
|
||||
|
||||
export default createComponent({
|
||||
props: {
|
||||
|
@ -22,14 +22,14 @@ export default createComponent({
|
|||
let intervalId: number = 0
|
||||
|
||||
/** The relative time string */
|
||||
const fromNow = ref(moment(props.value).fromNow())
|
||||
const fromNow = ref(formatDistance(props.value, Date.now(), { addSuffix: true }))
|
||||
|
||||
/** The actual date/time (used as the title for the relative time) */
|
||||
const actual = computed(() => moment(props.value).format('LLLL'))
|
||||
const actual = computed(() => format(props.value, 'PPPPp'))
|
||||
|
||||
/** Update the relative time string if it is different */
|
||||
const updateFromNow = () => {
|
||||
const newFromNow = moment(props.value).fromNow()
|
||||
const newFromNow = formatDistance(props.value, Date.now(), { addSuffix: true })
|
||||
if (newFromNow !== fromNow.value) fromNow.value = newFromNow
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ md-content(role='main').mpj-main-content
|
|||
|
||||
<script lang="ts">
|
||||
import { computed, createComponent, onMounted } from '@vue/composition-api'
|
||||
import moment from 'moment'
|
||||
import { format } from 'date-fns'
|
||||
|
||||
import api from '../../api'
|
||||
import { useProgress } from '../../App.vue'
|
||||
|
@ -80,7 +80,7 @@ export default createComponent({
|
|||
const prayedCount = computed(() => request.history.filter(hist => hist.status === 'Prayed').length)
|
||||
|
||||
/** Format a date */
|
||||
const formatDate = (asOf: number) => moment(asOf).format('LL')
|
||||
const formatDate = (asOf: number) => format(asOf, 'PPP')
|
||||
|
||||
onMounted(async () => {
|
||||
progress.events.$emit('show', 'indeterminate')
|
||||
|
|
|
@ -5,7 +5,6 @@ module.exports = {
|
|||
configureWebpack: {
|
||||
plugins: [
|
||||
// new BundleAnalyzerPlugin(),
|
||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
|
||||
],
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
|
|
|
@ -2954,6 +2954,11 @@ dashdash@^1.12.0:
|
|||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
date-fns@^2.8.1:
|
||||
version "2.8.1"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.8.1.tgz#2109362ccb6c87c3ca011e9e31f702bc09e4123b"
|
||||
integrity sha512-EL/C8IHvYRwAHYgFRse4MGAPSqlJVlOrhVYZ75iQBKrnv+ZedmYsgwH3t+BCDuZDXpoo07+q9j4qgSSOa7irJg==
|
||||
|
||||
de-indent@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
|
||||
|
@ -5845,11 +5850,6 @@ mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
|
|||
dependencies:
|
||||
minimist "0.0.8"
|
||||
|
||||
moment@^2.18.1:
|
||||
version "2.24.0"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
|
||||
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
|
||||
|
||||
move-concurrently@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|
||||
|
|
Loading…
Reference in New Issue
Block a user