Files
mc-tracker/src/utils/timeUtils.ts
2024-01-01 17:08:36 +00:00

19 lines
391 B
TypeScript

/**
* Gets the current date as YYYY-MM-DD.
*
* @returns the date
*/
export function getFormattedDate() {
return new Date().toISOString().slice(0, 10);
}
/**
* 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);
}