isToday
Checks whether a Luxon DateTime falls on the same calendar day as another DateTime, or today when no comparison value is provided. Pass the optional comparison value in tests to avoid depending on the real clock.
Importing
ts
import { isToday } from '@almighty-shogun/utils'Usage
ts
import { DateTime } from 'luxon'
import { isToday } from '@almighty-shogun/utils'
const shouldHighlight = isToday(DateTime.now());
// trueParameters
| Name | Type | Description |
|---|---|---|
dateTime | DateTime | Date to check. |
today | DateTime | Optional comparison date. |
Returns
true when both values share the same day.
Type signature
ts
declare function isToday(dateTime: DateTime, today?: DateTime): boolean;