2018-08-29 22:25:01 +02:00
|
|
|
/**
|
|
|
|
* Returns a MM/DD HH:MM timestamp for the current time
|
|
|
|
*/
|
2021-05-01 09:17:31 +02:00
|
|
|
export function getTimestamp(): string {
|
2021-09-05 01:09:30 +02: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 19:38:54 +02:00
|
|
|
|
2021-09-09 05:47:34 +02:00
|
|
|
return `${d.getMonth() + 1}/${d.getDate()} ${formattedHours}:${formattedMinutes}`;
|
2018-08-01 19:38:54 +02:00
|
|
|
}
|