forked from Tarun-Arora/sdg-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.js
More file actions
executable file
·34 lines (32 loc) · 736 Bytes
/
helper.js
File metadata and controls
executable file
·34 lines (32 loc) · 736 Bytes
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, slug });
}, 350);
} else {
store.dispatch('set', { resource, 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()}`;
};