Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const formatDateToUTC = date => {
- const month = `${date.getUTCMonth() + 1}`;
- const day = `${date.getUTCDate()}`;
- const hour = `${date.getUTCHours()}`;
- const min = `${date.getUTCMinutes()}`;
- const year = `${date.getFullYear()}`;
- const list = [year, month, day, hour, min];
- return list
- .map(v => {
- if (v.length === 1) {
- return `0${v}`;
- }
- return v;
- })
- .join('');
- };
- module.exports = formatDateToUTC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement