feat: calendar header formatting and data displaying (#160)

This commit is contained in:
Samuel Gunter
2024-03-13 21:38:40 -05:00
committed by GitHub
parent 61c1e88dcf
commit 5cce1c79fc
16 changed files with 57 additions and 10 deletions

View File

@@ -0,0 +1,21 @@
/**
*
* @param updatedAt {number} - The time in milliseconds since the epoch when the schedule was last updated.
* @returns {string} - DateTime formatted as HH:MM AM/PM MM/DD/YYYY
*/
export function getUpdatedAtDateTimeString(updatedAt: number): string {
const updatedAtDate = new Date(updatedAt);
const timeFormat = new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
minute: 'numeric',
hour12: true,
}).format(updatedAtDate);
const dateFormat = new Intl.DateTimeFormat('en-US', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}).format(updatedAtDate);
return `${timeFormat} ${dateFormat}`;
}