UNPKG

@naturalcycles/js-lib

Version:

Standard library for universal (browser + Node.js) javascript

50 lines (49 loc) 1.45 kB
import type { IsoDate, IsoDateTime } from '../types.js'; import { LocalDate } from './localDate.js'; import type { DateTimeObject, LocalTime } from './localTime.js'; /** * Representation of a "time on the wall clock", * which means "local time, regardless of timezone". * * Experimental simplified container object to hold * date and time components as numbers. * No math or manipulation is possible here. * Can be pretty-printed as Date, Time or DateAndTime. */ export declare class WallTime implements DateTimeObject { year: number; month: number; day: number; hour: number; minute: number; second: number; constructor(obj: DateTimeObject); toLocalDate(): LocalDate; /** * Example: * WallTime is 1984-06-21 17:56:21 * .toLocalTime() will return a LocalTime Date instance * holding that time in the local timezone. */ toLocalTime(): LocalTime; toJSON(): IsoDateTime; toString(): IsoDateTime; /** * Returns e.g: `1984-06-21 17:56:21` * or (if seconds=false): * `1984-06-21 17:56` */ toPretty(seconds?: boolean): string; /** * Returns e.g: `1984-06-21T17:56:21` */ toISODateTime(): IsoDateTime; /** * Returns e.g: `1984-06-21`, only the date part of DateTime */ toISODate(): IsoDate; /** * Returns e.g: `17:03:15` (or `17:03` with seconds=false) */ toISOTime(seconds?: boolean): string; }