mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Move makeLastUpdatedFriendly into parse-date
This commit is contained in:
parent
b4f2be414f
commit
86f61b1251
2 changed files with 13 additions and 9 deletions
|
|
@ -20,6 +20,17 @@ const getRelativeTime = function (d1, d2 = new Date()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function makeLastUpdatedFriendly ( lastUpdated ) {
|
||||||
|
|
||||||
|
if ( !lastUpdated ) return null
|
||||||
|
|
||||||
|
const options = { month: "long", day: "numeric", year: "numeric" }
|
||||||
|
const date = new Date( lastUpdated.raw )
|
||||||
|
const americanDate = new Intl.DateTimeFormat("en-US", options).format(date)
|
||||||
|
|
||||||
|
return americanDate
|
||||||
|
}
|
||||||
|
|
||||||
export default function (rawDate) {
|
export default function (rawDate) {
|
||||||
|
|
||||||
const date = new Date(rawDate)
|
const date = new Date(rawDate)
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import parseDate from '~/helpers/parse-date'
|
import { lastUpdatedFriendly } from '~/helpers/parse-date'
|
||||||
import { getAppEndpoint } from '~/helpers/app-derived.js'
|
import { getAppEndpoint } from '~/helpers/app-derived.js'
|
||||||
|
|
||||||
import LinkButton from '~/components/link-button.vue'
|
import LinkButton from '~/components/link-button.vue'
|
||||||
|
|
@ -105,14 +105,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
lastUpdatedFriendly () {
|
lastUpdatedFriendly () {
|
||||||
|
return lastUpdatedFriendly( this.app.lastUpdated )
|
||||||
if (this.app.lastUpdated === null) return
|
|
||||||
|
|
||||||
const options = { month: "long", day: "numeric", year: "numeric" }
|
|
||||||
const date = new Date(this.app.lastUpdated.raw)
|
|
||||||
const americanDate = new Intl.DateTimeFormat("en-US", options).format(date)
|
|
||||||
|
|
||||||
return americanDate
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue