Skip to content

Commit

Permalink
fix(lib): Update dateHelper to remove : from name for Windows compu…
Browse files Browse the repository at this point in the history
…ters
  • Loading branch information
DeFiFoFum committed May 13, 2024
1 parent ee6f12a commit 1553ce7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/node/dateHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const toISOStringNoHyphens = (date: Date) => date.toISOString().replace(/-/g, '')

const toISOStringNoHyphens = (date: Date) => date.toISOString().replace(/[-:]/g, '')
/**
* Gets the current date as a string in the format YYYYMMDD.
* This can be used for generating file names or any other date-based identifiers.
Expand All @@ -8,7 +7,7 @@ const toISOStringNoHyphens = (date: Date) => date.toISOString().replace(/-/g, ''
* @param {Date} date (optional) The date to convert to a string in the format YYYYMMDD. Defaults to the current date.
* @returns {string} The current date as a string in the format YYYYMMDD.
*/
export const getDateDayString = (date = new Date()) => toISOStringNoHyphens(date).slice(0, 8)
export const getDateDayString = (date = new Date()) => toISOStringNoHyphens(date).slice(0, 7)

/**
* Gets the current date and time as a string in the format YYYYMMDDTHH:MM.
Expand All @@ -18,7 +17,7 @@ export const getDateDayString = (date = new Date()) => toISOStringNoHyphens(date
* @param {Date} date (optional) The date to convert to a string in the format YYYYMMDDTHH:MM. Defaults to the current date.
* @returns {string} The current date and time as a string in the format YYYYMMDDTHH:MM.
*/
export const getDateMinuteString = (date = new Date()) => toISOStringNoHyphens(date).slice(0, 14)
export const getDateMinuteString = (date = new Date()) => toISOStringNoHyphens(date).slice(0, 13)

export const getDaysAgo = (dateString: string): number => {
const date = new Date(dateString)
Expand Down

0 comments on commit 1553ce7

Please sign in to comment.