Helpers

getFixedDate.mjs

@mr_ozio/scraper-utils · v2.5.0 · Generated April 21, 2026

Target Style

Target Style

2 exports

const

getFixedDate

Target Style
export const getFixedDate = (date = new Date()) => {

Rounds a date to the nearest hour.

Dates after half past are rounded up to the next full hour.

Target style API. Preferred for new code.

Parameters

  • [date=newDateDate()]

Returns

Date

Example

const fixedAt = roundDateToHour(new Date())

const

roundDateToHour

Target Style
export const roundDateToHour = (date = new Date()) => {

Rounds a date to the nearest hour with a more descriptive name.

Target style API. Preferred for new code.

Parameters

  • [date=newDateDate()]

Returns

Date

Legacy Style

Legacy Style

0 exports

No legacy exports in this module.