This repository was archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make helpers.ts for helper methods (#39)
- Loading branch information
1 parent
ba72d0c
commit 4a1fe20
Showing
5 changed files
with
26 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @file | ||
* This file exports helper methods that are used multiple times in modules/other code. | ||
*/ | ||
|
||
/** | ||
* Formats the current date to YYYY-MM-DD HH:MM:SS | ||
* @param date The current date | ||
*/ | ||
export function formatDate(date: Date): string { | ||
const year = date.getFullYear(); | ||
const month = (1 + date.getMonth()).toString().padStart(2, '0'); | ||
const day = date.getDate().toString().padStart(2, '0'); | ||
const hour = date.getHours().toString().padStart(2, '0'); | ||
const minute = date.getMinutes().toString().padStart(2, '0'); | ||
const second = date.getSeconds().toString().padStart(2, '0'); | ||
|
||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters