mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 16:22:56 +02:00
[refactor] pulling getTimestamp off Terminal
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
export function getTimestamp() {
|
||||
const d: Date = new Date();
|
||||
// A negative slice value takes from the end of the string rather than the beginning.
|
||||
const stringWidth: number = -2;
|
||||
const formattedHours: string = `0${d.getHours()}`.slice(stringWidth);
|
||||
const formattedMinutes: string = `0${d.getMinutes()}`.slice(stringWidth);
|
||||
|
||||
return `${d.getMonth() + 1}/${d.getDate()} ${formattedHours}:${formattedMinutes}`;
|
||||
}
|
||||
Reference in New Issue
Block a user