QScroller keeps the UI small and focused. @timestamp-js/core is the companion layer for date math, UTC persistence, interval snapping, and range validation when the selected values need to become application data.
Use the scroller for collection, then normalize the emitted value into a Timestamp before saving, comparing, or sending the value to an API.
Calendar Adapters
QDateScroller, QDateRangeScroller, and QDateTimeScroller model dates in the active Timestamp calendar system. For native calendar systems such as Islamic Civil (Hijri), Indian National (Saka), Hebrew, or Persian, pass calendar-system; string, array, and object model values use that calendar’s native YYYY-MM-DD fields, while JavaScript Date values remain Gregorian interop values.
Install the adapter package you need beside @timestamp-js/core:
pnpm add @timestamp-js/core @timestamp-js/calendar-hebrew @timestamp-js/calendar-islamic @timestamp-js/calendar-saka @timestamp-js/calendar-persianStore Instants Explicitly
QDateTimeScroller emits the same shape it received where possible. If your app stores instants in a database, normalize the emitted value, snap it if needed, and store Unix milliseconds.
import {
function getDateTime(timestamp: Timestamp): stringFormats a Timestamp as date plus time.getDateTime,
function roundToInterval(timestamp: Timestamp, minutes: number): TimestampRounds a Timestamp to the nearest interval.roundToInterval,
function toUnixMilliseconds(timestamp: Timestamp): numberConverts a Timestamp into Unix milliseconds by reading its fields as UTC.
This is deterministic across server and client runtimes. It does not read or
convert the optional `timezone` suffix stored on the Timestamp.toUnixMilliseconds,
function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp,
} from '@timestamp-js/core'
const const input: Timestamp | nullinput = function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp('2036-06-08 09:37')
const const snapped: Timestamp | nullsnapped = const input: Timestamp | nullinput === null ? null : function roundToInterval(timestamp: Timestamp, minutes: number): TimestampRounds a Timestamp to the nearest interval.roundToInterval(const input: Timestampinput, 15)
const snapped: Timestamp | nullsnapped === null ? null : function getDateTime(timestamp: Timestamp): stringFormats a Timestamp as date plus time.getDateTime(const snapped: Timestampsnapped) // "2036-06-08 09:30"
const snapped: Timestamp | nullsnapped === null ? null : function toUnixMilliseconds(timestamp: Timestamp): numberConverts a Timestamp into Unix milliseconds by reading its fields as UTC.
This is deterministic across server and client runtimes. It does not read or
convert the optional `timezone` suffix stored on the Timestamp.toUnixMilliseconds(const snapped: Timestampsnapped)Validate Ranges Outside The Picker
QDateRangeScroller validates that the end date does not come before the start date. Domain validation, such as checking blackout windows, booking windows, or availability gaps, belongs in your app logic.
import {
function createTimestampRange(start: Timestamp, end: Timestamp, useTime?: boolean): TimestampRangeCreates an inclusive Timestamp range and normalizes start/end order.createTimestampRange,
function findRangeGaps(source: TimestampRange, occupied: TimestampRange[], useTime?: boolean): TimestampRange[]Finds open gaps inside a source range after occupied ranges are removed.
This is an alias for subtractRanges() with naming that reads naturally in
booking, resource, and availability workflows.findRangeGaps,
function isRangeOverlapping(first: TimestampRange, second: TimestampRange, useTime?: boolean): booleanChecks whether two inclusive TimestampRange values overlap.isRangeOverlapping,
function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp,
} from '@timestamp-js/core'
const const request: TimestampRangerequest = function createTimestampRange(start: Timestamp, end: Timestamp, useTime?: boolean): TimestampRangeCreates an inclusive Timestamp range and normalizes start/end order.createTimestampRange(
function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp('2036-06-08 00:00')!,
function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp('2036-06-12 00:00')!,
)
const const blackout: TimestampRangeblackout = function createTimestampRange(start: Timestamp, end: Timestamp, useTime?: boolean): TimestampRangeCreates an inclusive Timestamp range and normalizes start/end order.createTimestampRange(
function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp('2036-06-14 00:00')!,
function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp('2036-06-17 00:00')!,
)
function isRangeOverlapping(first: TimestampRange, second: TimestampRange, useTime?: boolean): booleanChecks whether two inclusive TimestampRange values overlap.isRangeOverlapping(const request: TimestampRangerequest, const blackout: TimestampRangeblackout) // false
function findRangeGaps(source: TimestampRange, occupied: TimestampRange[], useTime?: boolean): TimestampRange[]Finds open gaps inside a source range after occupied ranges are removed.
This is an alias for subtractRanges() with naming that reads naturally in
booking, resource, and availability workflows.findRangeGaps(const request: TimestampRangerequest, [const blackout: TimestampRangeblackout]) // request is still openPreserve UI Precision
QScroller date-time views are minute-focused today. Timestamp can still parse, store, and format seconds and milliseconds for API payloads, audit values, or background scheduling state.
import { function makeDateTimeUTC(timestamp: Timestamp): DateConverts a Timestamp date and time into a UTC JavaScript Date.makeDateTimeUTC, function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp } from '@timestamp-js/core'
const const timestamp: Timestamp | nulltimestamp = function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | nullConverts a supported date or date-time string into a formatted Timestamp object.
If `now` is supplied, the returned timestamp also includes relative flags
such as `past`, `current`, `future`, and `currentWeekday`.parseTimestamp('2036-06-08T09:30:15.250Z')
const timestamp: Timestamp | nulltimestamp?.Timestamp.second?: number | undefinedOptional second of the minute.second // 15
const timestamp: Timestamp | nulltimestamp?.Timestamp.millisecond?: number | undefinedOptional millisecond of the second.millisecond // 250
const timestamp: Timestamp | nulltimestamp === null ? null : function makeDateTimeUTC(timestamp: Timestamp): DateConverts a Timestamp date and time into a UTC JavaScript Date.makeDateTimeUTC(const timestamp: Timestamptimestamp).Date.toISOString(): stringReturns a date as a string value in ISO format.toISOString()