Skip to content

Commit 97c671b

Browse files
Removed moment dependency (smaller bundle size)
1 parent 3d70202 commit 97c671b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

components/BlogTile.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</template>
5353

5454
<script>
55-
import moment from 'moment'
55+
import dayjs from 'dayjs'
5656
5757
export default {
5858
props: {
@@ -72,7 +72,7 @@ export default {
7272
return JSON.parse(this.post.blog_categories)
7373
},
7474
publishDate () {
75-
return moment.unix(this.post.publish_date).format('MM/DD/YY h:mmA')
75+
return dayjs.unix(this.post.publish_date).format('MM/DD/YY h:mmA')
7676
},
7777
imageObj () {
7878
return {

pages/BlogPost.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ import { isServer } from '@vue-storefront/core/helpers'
106106
import config from 'config'
107107
import { htmlDecode } from '@vue-storefront/core/filters/html-decode'
108108
import { mapGetters } from 'vuex'
109-
import moment from 'moment'
109+
import dayjs from 'dayjs'
110110
111111
const composeInitialPageState = async (store, route, force = false) => {
112112
try {
@@ -140,7 +140,7 @@ export default {
140140
return JSON.parse(this.post.blog_categories)
141141
},
142142
publishDate () {
143-
return moment.unix(this.post.publish_date).format('MM/DD/YY h:mmA')
143+
return dayjs.unix(this.post.publish_date).format('MM/DD/YY h:mmA')
144144
},
145145
pageTitle () {
146146
const title = [this.post.title, this.$t('Blog')]
@@ -158,8 +158,8 @@ export default {
158158
'image': [
159159
'${this.post.featured_image_file}'
160160
],
161-
'datePublished': '${moment.unix(this.post.publish_date).format('YYYY-MM-DD H:mm')}',
162-
'dateModified': '${moment.unix(this.post.publish_date).format('YYYY-MM-DD H:mm')}',
161+
'datePublished': '${dayjs.unix(this.post.publish_date).format('YYYY-MM-DD H:mm')}',
162+
'dateModified': '${dayjs.unix(this.post.publish_date).format('YYYY-MM-DD H:mm')}',
163163
'author': {
164164
'@type': 'Person',
165165
'name': '${this.post.author_name}'
@@ -211,7 +211,7 @@ export default {
211211
},
212212
methods: {
213213
dateToReadable (date) {
214-
return moment.unix(date).format('MM/DD/YY h:mmA')
214+
return dayjs.unix(date).format('MM/DD/YY h:mmA')
215215
}
216216
}
217217
}

0 commit comments

Comments
 (0)