Skip to content

Commit

Permalink
Remove unused utilities
Browse files Browse the repository at this point in the history
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
  • Loading branch information
koddsson and keithamus committed Oct 25, 2022
1 parent dbb8561 commit f3b8df5
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,6 @@ export function isDayFirst(locale = 'default'): boolean {
}
}

let yearSeparator: boolean | null = null
const yearFormatter = makeFormatter({day: 'numeric', month: 'short', year: 'numeric'})

// Private: Determine if the year should be separated from the month and day
// with a comma. For example, `9 Jun 2014` in en-GB and `Jun 9, 2014` in en-US.
//
// Returns true if the date needs a separator.
export function isYearSeparator(): boolean {
if (yearSeparator !== null) {
return yearSeparator
}

const formatter = yearFormatter()
if (formatter) {
const output = formatter.format(new Date(0))
yearSeparator = !!output.match(/\d,/)
return yearSeparator
} else {
return true
}
}

// Private: Determine if the date occurs in the same year as today's date.
//
// date - The Date to test.
//
// Returns true if it's this year.
export function isThisYear(date: Date): boolean {
const now = new Date()
return now.getUTCFullYear() === date.getUTCFullYear()
}

// Private: Get preferred Intl locale for a target element.
//
// Traverses parents until it finds an explicit `lang` other returns "default".
Expand Down

0 comments on commit f3b8df5

Please sign in to comment.