date-vir
Version:
Easy and explicit dates and times.
52 lines (51 loc) • 1.12 kB
TypeScript
import { FullDate } from '../full-date/full-date-shape.js';
import { UtcIsoString } from './string-format-types.js';
/**
* Convert a FullDate into a unix timestamp with milliseconds.
*
* @category Formatting
* @example
*
* ```ts
* import {toTimestamp} from 'date-vir';
*
* const exampleDate: FullDate = {
* year: 2024,
* month: 1,
* day: 5,
* hour: 1,
* minute: 1,
* second: 1,
* millisecond: 1,
* timezone: 'UTC',
* };
*
* toTimestamp(exampleDate); // `1704416461001`
* ```
*/
export declare function toTimestamp(fullDate: FullDate): number;
/**
* Convert a FullDate into a UTC ISO string, always ending in Z.
*
* @category ISO
* @category Formatting
* @example
*
* ```ts
* import {toUtcIsoString} from 'date-vir';
*
* const exampleDate: FullDate = {
* year: 2024,
* month: 1,
* day: 5,
* hour: 1,
* minute: 1,
* second: 1,
* millisecond: 1,
* timezone: 'UTC',
* };
*
* toUtcIsoString(exampleDate); // `'2024-01-05T01:01:01.001Z'`
* ```
*/
export declare function toUtcIsoString(fullDate: FullDate): UtcIsoString;