forked from github/plane
15 lines
297 B
TypeScript
15 lines
297 B
TypeScript
|
export const timeAgo = (time: any) => {
|
||
|
switch (typeof time) {
|
||
|
case "number":
|
||
|
break;
|
||
|
case "string":
|
||
|
time = +new Date(time);
|
||
|
break;
|
||
|
case "object":
|
||
|
if (time.constructor === Date) time = time.getTime();
|
||
|
break;
|
||
|
default:
|
||
|
time = +new Date();
|
||
|
}
|
||
|
};
|