UNPKG

rrule-rust

Version:

RRule implementation for Node.js written in Rust

56 lines (55 loc) 1.84 kB
export interface DateTimeLike { readonly year: number; readonly month: number; readonly day: number; readonly hour: number; readonly minute: number; readonly second: number; } export interface FromObjectOptions { utc?: boolean; } /** * Represents a date and time. Either local or UTC. */ export declare class DateTime implements DateTimeLike { private readonly numeric; private constructor(); get year(): number; get month(): number; get day(): number; get hour(): number; get minute(): number; get second(): number; get utc(): boolean; /** * Creates a new DateTime object from the given date and time components. */ static create(year: number, month: number, day: number, hour: number, minute: number, second: number, utc: boolean): DateTime; /** * This method is shorthand for `DateTime.create` with `utc` set to `false`. */ static local(year: number, month: number, day: number, hour: number, minute: number, second: number): DateTime; /** * This method is shorthand for `DateTime.create` with `utc` set to `true`. */ static utc(year: number, month: number, day: number, hour: number, minute: number, second: number): DateTime; /** * Creates a new DateTime object from the given plain object. */ static fromObject(object: DateTimeLike, options?: FromObjectOptions): DateTime; /** * Creates a new DateTime object from provided string representation of a date according to RFC 5545. */ static fromString(str: string): DateTime; /** * Converts DateTime into a plain object. */ toObject(): DateTimeLike; /** * Converts DateTime into ISO 8601 string: * - `YYYYMMDDTHHMMSSZ` for UTC * - `YYYYMMDDTHHMMSS` for local */ toString(): string; }