2018-08-29 15:25:01 -05:00
|
|
|
/**
|
|
|
|
* Returns a MM/DD HH:MM timestamp for the current time
|
|
|
|
*/
|
2021-05-01 03:17:31 -04:00
|
|
|
export function getTimestamp(): string {
|
2021-09-04 19:09:30 -04:00
|
|
|
const d: Date = new Date();
|
|
|
|
// A negative slice value takes from the end of the string rather than the beginning.
|
|
|
|
const stringWidth = -2;
|
|
|
|
const formattedHours: string = `0${d.getHours()}`.slice(stringWidth);
|
|
|
|
const formattedMinutes: string = `0${d.getMinutes()}`.slice(stringWidth);
|
2018-08-01 13:38:54 -04:00
|
|
|
|
2021-09-08 23:47:34 -04:00
|
|
|
return `${d.getMonth() + 1}/${d.getDate()} ${formattedHours}:${formattedMinutes}`;
|
2018-08-01 13:38:54 -04:00
|
|
|
}
|