website refactor
This commit is contained in:
@@ -35,4 +35,15 @@ export class DateDisplay {
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
return `${months[d.getUTCMonth()]} ${d.getUTCDate()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a date as "Jan 18, 15:00" using UTC.
|
||||
*/
|
||||
static formatDateTime(date: string | Date): string {
|
||||
const d = typeof date === 'string' ? new Date(date) : date;
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
const hours = d.getUTCHours().toString().padStart(2, '0');
|
||||
const minutes = d.getUTCMinutes().toString().padStart(2, '0');
|
||||
return `${months[d.getUTCMonth()]} ${d.getUTCDate()}, ${hours}:${minutes}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user