Files
mc-tracker/src/utils/timeUtils.ts

19 lines
391 B
TypeScript
Raw Normal View History

2024-01-01 17:04:19 +00:00
/**
* Gets the current date as YYYY-MM-DD.
*
* @returns the date
*/
export function getFormattedDate() {
return new Date().toISOString().slice(0, 10);
}
2024-01-01 17:08:36 +00:00
/**
* Formats a timestamp as YYYY-MM-DD.
*
* @param timestamp the timestamp
* @returns the formatted timestamp
*/
export function formatTimestamp(timestamp: number) {
return new Date(timestamp).toISOString().slice(0, 10);
}