Skip to content

isBeforeNow

Checks whether a Luxon DateTime is earlier than the current moment. Use it for expiration checks, overdue states, and disabling actions after a deadline.

Importing

ts
import { isBeforeNow } from '@almighty-shogun/utils'

Usage

ts
import { DateTime } from 'luxon'
import { isBeforeNow } from '@almighty-shogun/utils'

const expired = isBeforeNow(DateTime.now().minus({ minutes: 1 }));

// true

Parameters

NameTypeDescription
dateDateTimeDate to compare.

Returns

true when date is earlier than now.

Type signature

ts
declare function isBeforeNow(date: DateTime): boolean;

All packages are released under the MIT License.