-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.js
executable file
·34 lines (32 loc) · 757 Bytes
/
helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export const setPageData = (store, { resource, slug }) => {
if (process.browser) {
setTimeout(() => {
store.dispatch('set', { resource: resource, slug: slug })
}, 350)
} else {
store.dispatch('set', { resource: resource, slug: slug })
}
}
export const fullUrl = () => {
return `${window.location.protocol}//${window.location.host}/${window.location.pathname}`
}
export const getFormattedDate = (date) => {
const months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
]
const dateObj = new Date(date)
return `${
months[dateObj.getMonth()]
} ${dateObj.getDate()}, ${dateObj.getFullYear()}`
}