You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

13 lines
398 B

export const readableUtcDate = date =>
date ? date.toISOString().substr(0, 19).replace('T', ' ') : 'undefined';
export const readableDate = d => {
if (!d) return undefined;
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(
d.getDate(),
)} ${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`;
};
function pad2(string) {
return `0${string}`.slice(-2);
}