@types/luxon
Advanced tools
| import { | ||
| CalendarSystem, | ||
| DateTimeFormatOptions, | ||
| NumberingSystem, | ||
| StringUnitLength, ToISOFormat, ToISOTimeDurationOptions, | ||
| ZoneOptions, | ||
| } from '../index'; | ||
| import { Zone } from './zone'; | ||
| import { Duration, DurationInput, DurationUnit, DurationUnits } from './duration'; | ||
| import { Interval } from './interval'; | ||
| export type ToRelativeUnit = | ||
| | 'years' | ||
| | 'quarters' | ||
| | 'months' | ||
| | 'weeks' | ||
| | 'days' | ||
| | 'hours' | ||
| | 'minutes' | ||
| | 'seconds'; | ||
| export interface ToRelativeOptions extends ToRelativeCalendarOptions { | ||
| /** | ||
| * @default long | ||
| */ | ||
| style?: StringUnitLength; | ||
| /** @default true */ | ||
| round?: boolean; | ||
| /** | ||
| * Padding in milliseconds. This allows you to round up the result if it fits inside the threshold. | ||
| * Don't use in combination with {round: false} because the decimal output will include the padding. | ||
| * @default 0 | ||
| */ | ||
| padding?: number; | ||
| } | ||
| export interface ToRelativeCalendarOptions { | ||
| /** | ||
| * The DateTime to use as the basis to which this time is compared | ||
| * @default now | ||
| */ | ||
| base?: DateTime; | ||
| /** | ||
| * Override the locale of this DateTime | ||
| */ | ||
| locale?: string; | ||
| /** If omitted, the method will pick the unit. */ | ||
| unit?: ToRelativeUnit; | ||
| /** | ||
| * Override the numberingSystem of this DateTime. | ||
| * The Intl system may choose not to honor this. | ||
| */ | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| export interface ToSQLOptions { | ||
| /** | ||
| * Include the offset, such as 'Z' or '-04:00' | ||
| * @default true | ||
| */ | ||
| includeOffset?: boolean; | ||
| /** | ||
| * Include the zone, such as 'America/New_York'. Overrides includeOffset. | ||
| * @default false | ||
| */ | ||
| includeZone?: boolean; | ||
| } | ||
| export interface ToISODateOptions { | ||
| /** | ||
| * Choose between the basic and extended format | ||
| * @default 'extended' | ||
| */ | ||
| format?: ToISOFormat; | ||
| } | ||
| export interface ToISOTimeOptions extends ToISOTimeDurationOptions { | ||
| /** | ||
| * Include the offset, such as 'Z' or '-04:00' | ||
| * @default true | ||
| */ | ||
| includeOffset?: boolean; | ||
| } | ||
| /** @deprecated alias for backwards compatibility */ | ||
| export type ISOTimeOptions = ToISOTimeOptions; | ||
| export interface LocaleOptions { | ||
| /** | ||
| * @default system's locale | ||
| */ | ||
| locale?: string; | ||
| outputCalendar?: CalendarSystem; | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| export interface DateTimeOptions extends LocaleOptions { | ||
| /** | ||
| * Use this zone if no offset is specified in the input string itself. Will also convert the time to this zone. | ||
| * @default local | ||
| */ | ||
| zone?: string | Zone; | ||
| /** | ||
| * Override the zone with a fixed-offset zone specified in the string itself, if it specifies one. | ||
| * @default false | ||
| */ | ||
| setZone?: boolean; | ||
| } | ||
| export type DateTimeJSOptions = Omit<DateTimeOptions, 'setZone'>; | ||
| export interface DateObjectUnits { | ||
| // a year, such as 1987 | ||
| year?: number; | ||
| // a month, 1-12 | ||
| month?: number; | ||
| // a day of the month, 1-31, depending on the month | ||
| day?: number; | ||
| // day of the year, 1-365 or 366 | ||
| ordinal?: number; | ||
| // an ISO week year | ||
| weekYear?: number; | ||
| // an ISO week number, between 1 and 52 or 53, depending on the year | ||
| weekNumber?: number; | ||
| // an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday | ||
| weekday?: number; | ||
| // hour of the day, 0-23 | ||
| hour?: number; | ||
| // minute of the hour, 0-59 | ||
| minute?: number; | ||
| // second of the minute, 0-59 | ||
| second?: number; | ||
| // millisecond of the second, 0-999 | ||
| millisecond?: number; | ||
| } | ||
| export interface DateObject extends DateObjectUnits, LocaleOptions { | ||
| zone?: string | Zone; | ||
| } | ||
| export type ConversionAccuracy = 'casual' | 'longterm'; | ||
| export interface DiffOptions { | ||
| conversionAccuracy?: ConversionAccuracy; | ||
| } | ||
| export interface ExplainedFormat { | ||
| input: string; | ||
| tokens: Array<{ literal: boolean; val: string }>; | ||
| regex?: RegExp; | ||
| rawMatches?: RegExpMatchArray | null; | ||
| matches?: { [k: string]: any }; | ||
| result?: { [k: string]: any } | null; | ||
| zone?: Zone | null; | ||
| invalidReason?: string; | ||
| } | ||
| /** | ||
| * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. | ||
| * It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. | ||
| * | ||
| * A DateTime comprises of: | ||
| * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. | ||
| * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). | ||
| * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. | ||
| * | ||
| * Here is a brief overview of the most commonly used functionality it provides: | ||
| * | ||
| * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. | ||
| * To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. | ||
| * To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. | ||
| * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually | ||
| * (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. | ||
| * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. | ||
| * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. | ||
| * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, | ||
| * {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. | ||
| * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, | ||
| * {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. | ||
| * | ||
| * There's plenty others documented below. In addition, for more information on subtler topics | ||
| * like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. | ||
| */ | ||
| export class DateTime { | ||
| /** | ||
| * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_FULL: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_FULL_WITH_SECONDS: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_HUGE: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_HUGE_WITH_SECONDS: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_MED: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_MED_WITH_SECONDS: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_MED_WITH_WEEKDAY: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_SHORT: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly DATETIME_SHORT_WITH_SECONDS: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'October 14, 1983' | ||
| */ | ||
| static readonly DATE_FULL: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Tuesday, October 14, 1983' | ||
| */ | ||
| static readonly DATE_HUGE: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Oct 14, 1983' | ||
| */ | ||
| static readonly DATE_MED: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 'Fri, Oct 14, 1983' | ||
| */ | ||
| static readonly DATE_MED_WITH_WEEKDAY: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like 10/14/1983 | ||
| */ | ||
| static readonly DATE_SHORT: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30', always 24-hour. | ||
| */ | ||
| static readonly TIME_24_SIMPLE: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. | ||
| */ | ||
| static readonly TIME_24_WITH_LONG_OFFSET: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30:23', always 24-hour. | ||
| */ | ||
| static readonly TIME_24_WITH_SECONDS: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. | ||
| */ | ||
| static readonly TIME_24_WITH_SHORT_OFFSET: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly TIME_SIMPLE: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly TIME_WITH_LONG_OFFSET: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly TIME_WITH_SECONDS: DateTimeFormatOptions; | ||
| /** | ||
| * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. | ||
| */ | ||
| static readonly TIME_WITH_SHORT_OFFSET: DateTimeFormatOptions; | ||
| /** | ||
| * Create a DateTime from an HTTP header date | ||
| * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 | ||
| * @param text - the HTTP header date | ||
| * @param [options] - options to affect the creation | ||
| * @param [options.zone='local'] - convert the time to this zone. | ||
| * Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. | ||
| * @example | ||
| * DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') | ||
| * @example | ||
| * DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') | ||
| * @example | ||
| * DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') | ||
| */ | ||
| static fromHTTP(text: string, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from an ISO 8601 string | ||
| * @example | ||
| * DateTime.fromISO('2016-05-25T09:08:34.123') | ||
| * @example | ||
| * DateTime.fromISO('2016-05-25T09:08:34.123+06:00') | ||
| * @example | ||
| * DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) | ||
| * @example | ||
| * DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) | ||
| * @example | ||
| * DateTime.fromISO('2016-W05-4') | ||
| */ | ||
| static fromISO(text: string, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from a JavaScript Date object. | ||
| * Uses the default zone. | ||
| */ | ||
| static fromJSDate(date: Date, options?: DateTimeJSOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). | ||
| * Uses the default zone. | ||
| */ | ||
| static fromMillis(ms: number, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. | ||
| * @example | ||
| * DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' | ||
| * @example | ||
| * DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' | ||
| * @example | ||
| * DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 | ||
| * @example | ||
| * DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), | ||
| * @example | ||
| * DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) | ||
| * @example | ||
| * DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) | ||
| * @example | ||
| * DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' | ||
| */ | ||
| static fromObject(obj: DateObject): DateTime; | ||
| /** | ||
| * Create a DateTime from an RFC 2822 string | ||
| * @example | ||
| * DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') | ||
| * @example | ||
| * DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') | ||
| * @example | ||
| * DateTime.fromRFC2822('25 Nov 2016 13:23 Z') | ||
| */ | ||
| static fromRFC2822(text: string, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). | ||
| * Uses the default zone. | ||
| */ | ||
| static fromSeconds(seconds: number, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from a SQL date, time, or datetime | ||
| * Defaults to en-US if no locale has been specified, regardless of the system's locale | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15') | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15 09:12:34') | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15 09:12:34.342') | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) | ||
| * @example | ||
| * DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) | ||
| * @example | ||
| * DateTime.fromSQL('09:12:34.342') | ||
| */ | ||
| static fromSQL(text: string, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Create a DateTime from an input string and format string. | ||
| * Defaults to en-US if no locale has been specified, regardless of the system's locale. | ||
| * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens | ||
| */ | ||
| static fromFormat(text: string, format: string, opts?: DateTimeOptions): DateTime; | ||
| /** | ||
| * Explain how a string would be parsed by {@link fromFormat} | ||
| */ | ||
| static fromFormatExplain(text: string, format: string, opts?: DateTimeOptions): ExplainedFormat; | ||
| /** | ||
| * @deprecated since 0.3.0. Use {@link fromFormat} instead | ||
| */ | ||
| static fromString(text: string, format: string, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * @deprecated 0.3.0. Use {@link fromFormatExplain} instead | ||
| */ | ||
| static fromStringExplain( | ||
| text: string, | ||
| format: string, | ||
| options?: DateTimeOptions, | ||
| ): ExplainedFormat; | ||
| /** | ||
| * Create an invalid DateTime. | ||
| * @param reason - simple string of why this DateTime is invalid. | ||
| * Should not contain parameters or anything else data-dependent | ||
| * @param [explanation] - longer explanation, may include parameters and other useful debugging information | ||
| */ | ||
| static invalid(reason: string, explanation?: string): DateTime; | ||
| /** | ||
| * Check if an object is a DateTime. Works across context boundaries | ||
| */ | ||
| static isDateTime(o: any): o is DateTime; | ||
| /** | ||
| * Create a local DateTime | ||
| * @param [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used | ||
| * @param [month=1] - The month, 1-indexed | ||
| * @param [day=1] - The day of the month, 1-indexed | ||
| * @param [hour=0] - The hour of the day, in 24-hour time | ||
| * @param [minute=0] - The minute of the hour, meaning a number between 0 and 59 | ||
| * @param [second=0] - The second of the minute, meaning a number between 0 and 59 | ||
| * @param [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 | ||
| * @example | ||
| * DateTime.local() //~> now | ||
| * @example | ||
| * DateTime.local(2017) //~> 2017-01-01T00:00:00 | ||
| * @example | ||
| * DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 | ||
| * @example | ||
| * DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 | ||
| * @example | ||
| * DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 | ||
| * @example | ||
| * DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 | ||
| * @example | ||
| * DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 | ||
| * @example | ||
| * DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 | ||
| */ | ||
| static local( | ||
| year?: number, | ||
| month?: number, | ||
| day?: number, | ||
| hour?: number, | ||
| minute?: number, | ||
| second?: number, | ||
| millisecond?: number, | ||
| ): DateTime; | ||
| /** Return the maximum of several date times */ | ||
| static max(): undefined; | ||
| /** Return the maximum of several date times */ | ||
| static max(...dateTimes: DateTime[]): DateTime; | ||
| /** Return the minimum of several date times */ | ||
| static min(): undefined; | ||
| /** Return the minimum of several date times */ | ||
| static min(...dateTimes: DateTime[]): DateTime; | ||
| /** | ||
| * Create a DateTime for the current instant, in the system's time zone. | ||
| * | ||
| * Use Settings to override these default values if needed. | ||
| * @example | ||
| * DateTime.now().toISO() //~> now in the ISO format | ||
| */ | ||
| static now(): DateTime; | ||
| /** | ||
| * Create a DateTime in UTC | ||
| * @param [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used | ||
| * @param [month=1] - The month, 1-indexed | ||
| * @param [day=1] - The day of the month | ||
| * @param [hour=0] - The hour of the day, in 24-hour time | ||
| * @param [minute=0] - The minute of the hour, meaning a number between 0 and 59 | ||
| * @param [second=0] - The second of the minute, meaning a number between 0 and 59 | ||
| * @param [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 | ||
| * @example | ||
| * DateTime.utc() //~> now | ||
| * @example | ||
| * DateTime.utc(2017) //~> 2017-01-01T00:00:00Z | ||
| * @example | ||
| * DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z | ||
| * @example | ||
| * DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z | ||
| * @example | ||
| * DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z | ||
| * @example | ||
| * DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z | ||
| * @example | ||
| * DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z | ||
| * @example | ||
| * DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z | ||
| */ | ||
| static utc( | ||
| year?: number, | ||
| month?: number, | ||
| day?: number, | ||
| hour?: number, | ||
| minute?: number, | ||
| second?: number, | ||
| millisecond?: number, | ||
| ): DateTime; | ||
| /** | ||
| * Get the day of the month (1-30ish). | ||
| * @example | ||
| * DateTime.local(2017, 5, 25).day //=> 25 | ||
| */ | ||
| day: number; | ||
| /** | ||
| * Returns the number of days in this DateTime's month | ||
| * @example | ||
| * DateTime.local(2016, 2).daysInMonth //=> 29 | ||
| * @example | ||
| * DateTime.local(2016, 3).daysInMonth //=> 31 | ||
| */ | ||
| daysInMonth: number; | ||
| /** | ||
| * Returns the number of days in this DateTime's year | ||
| * @example | ||
| * DateTime.local(2016).daysInYear //=> 366 | ||
| * @example | ||
| * DateTime.local(2013).daysInYear //=> 365 | ||
| */ | ||
| daysInYear: number; | ||
| /** | ||
| * Get the hour of the day (0-23). | ||
| * @example | ||
| * DateTime.local(2017, 5, 25, 9).hour //=> 9 | ||
| */ | ||
| hour: number; | ||
| /** | ||
| * Returns an error code if this DateTime is invalid, or null if the DateTime is valid | ||
| */ | ||
| invalidReason: string | null; | ||
| /** | ||
| * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid | ||
| */ | ||
| invalidExplanation: string | null; | ||
| /** | ||
| * Get whether the DateTime is in a DST. | ||
| */ | ||
| isInDST: boolean; | ||
| /** | ||
| * Returns true if this DateTime is in a leap year, false otherwise | ||
| * @example | ||
| * DateTime.local(2016).isInLeapYear //=> true | ||
| * @example | ||
| * DateTime.local(2013).isInLeapYear //=> false | ||
| */ | ||
| isInLeapYear: boolean; | ||
| /** | ||
| * Get whether this zone's offset ever changes, as in a DST. | ||
| */ | ||
| isOffsetFixed: boolean; | ||
| /** | ||
| * Returns whether the DateTime is valid. Invalid DateTimes occur when: | ||
| * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 | ||
| * * The DateTime was created by an operation on another invalid date | ||
| */ | ||
| isValid: boolean; | ||
| /** | ||
| * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime | ||
| * | ||
| */ | ||
| locale: string; | ||
| /** | ||
| * Get the millisecond of the second (0-999). | ||
| * @example | ||
| * DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 | ||
| */ | ||
| millisecond: number; | ||
| /** | ||
| * Get the minute of the hour (0-59). | ||
| * @example | ||
| * DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 | ||
| */ | ||
| minute: number; | ||
| /** | ||
| * Get the month (1-12). | ||
| * @example | ||
| * DateTime.local(2017, 5, 25).month //=> 5 | ||
| */ | ||
| month: number; | ||
| /** | ||
| * Get the human readable long month name, such as 'October'. | ||
| * Defaults to the system's locale if no locale has been specified | ||
| * @example | ||
| * DateTime.local(2017, 10, 30).monthLong //=> October | ||
| */ | ||
| monthLong: string; | ||
| /** | ||
| * Get the human readable short month name, such as 'Oct'. | ||
| * Defaults to the system's locale if no locale has been specified | ||
| * @example | ||
| * DateTime.local(2017, 10, 30).monthShort //=> Oct | ||
| */ | ||
| monthShort: string; | ||
| /** | ||
| * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime | ||
| * | ||
| */ | ||
| numberingSystem: string; | ||
| /** | ||
| * Get the UTC offset of this DateTime in minutes | ||
| * @example | ||
| * DateTime.now().offset //=> -240 | ||
| * @example | ||
| * DateTime.utc().offset //=> 0 | ||
| */ | ||
| offset: number; | ||
| /** | ||
| * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". | ||
| * Defaults to the system's locale if no locale has been specified | ||
| */ | ||
| offsetNameLong: string; | ||
| /** | ||
| * Get the short human name for the zone's current offset, for example "EST" or "EDT". | ||
| * Defaults to the system's locale if no locale has been specified | ||
| */ | ||
| offsetNameShort: string; | ||
| /** | ||
| * Get the ordinal (meaning the day of the year) | ||
| * @example | ||
| * DateTime.local(2017, 5, 25).ordinal //=> 145 | ||
| */ | ||
| ordinal: number; | ||
| /** | ||
| * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime | ||
| */ | ||
| outputCalendar: string; | ||
| /** | ||
| * Get the quarter | ||
| * @example | ||
| * DateTime.local(2017, 5, 25).quarter //=> 2 | ||
| */ | ||
| quarter: number; | ||
| /** | ||
| * Get the second of the minute (0-59). | ||
| * @example | ||
| * DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 | ||
| */ | ||
| second: number; | ||
| /** | ||
| * Get the week number of the week year (1-52ish). | ||
| * @see https://en.wikipedia.org/wiki/ISO_week_date | ||
| * @example | ||
| * DateTime.local(2017, 5, 25).weekNumber //=> 21 | ||
| */ | ||
| weekNumber: number; | ||
| /** | ||
| * Get the week year | ||
| * @see https://en.wikipedia.org/wiki/ISO_week_date | ||
| * @example | ||
| * DateTime.local(2014, 11, 31).weekYear //=> 2015 | ||
| */ | ||
| weekYear: number; | ||
| /** | ||
| * Get the day of the week. | ||
| * 1 is Monday and 7 is Sunday | ||
| * @see https://en.wikipedia.org/wiki/ISO_week_date | ||
| * @example | ||
| * DateTime.local(2014, 11, 31).weekday //=> 4 | ||
| */ | ||
| weekday: number; | ||
| /** | ||
| * Get the human readable long weekday, such as 'Monday'. | ||
| * Defaults to the system's locale if no locale has been specified | ||
| * @example | ||
| * DateTime.local(2017, 10, 30).weekdayLong //=> Monday | ||
| */ | ||
| weekdayLong: string; | ||
| /** | ||
| * Get the human readable short weekday, such as 'Mon'. | ||
| * Defaults to the system's locale if no locale has been specified | ||
| * @example | ||
| * DateTime.local(2017, 10, 30).weekdayShort //=> Mon | ||
| */ | ||
| weekdayShort: string; | ||
| /** | ||
| * Returns the number of weeks in this DateTime's year | ||
| * @see https://en.wikipedia.org/wiki/ISO_week_date | ||
| * @example | ||
| * DateTime.local(2004).weeksInWeekYear //=> 53 | ||
| * @example | ||
| * DateTime.local(2013).weeksInWeekYear //=> 52 | ||
| */ | ||
| weeksInWeekYear: number; | ||
| /** | ||
| * Get the year | ||
| * @example | ||
| * DateTime.local(2017, 5, 25).year //=> 2017 | ||
| */ | ||
| year: number; | ||
| /** | ||
| * Get the name of the time zone. | ||
| */ | ||
| zoneName: string; | ||
| /** | ||
| * Get the time zone associated with this DateTime. | ||
| */ | ||
| zone: Zone; | ||
| /** | ||
| * Return the difference between two DateTimes as a Duration. | ||
| * @param other - the DateTime to compare this one to | ||
| * @param [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. | ||
| * @param [options] - options that affect the creation of the Duration | ||
| * @param [options.conversionAccuracy='casual'] - the conversion system to use | ||
| * @example | ||
| * let i1 = DateTime.fromISO('1982-05-25T09:45'), | ||
| * i2 = DateTime.fromISO('1983-10-14T10:30'); | ||
| * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } | ||
| * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } | ||
| * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } | ||
| * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } | ||
| */ | ||
| diff(other: DateTime, unit?: DurationUnits, options?: DiffOptions): Duration; | ||
| /** | ||
| * Return the difference between this DateTime and right now. | ||
| * See {@link diff} | ||
| * @param [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration | ||
| * @param [options] - options that affect the creation of the Duration | ||
| * @param [options.conversionAccuracy='casual'] - the conversion system to use | ||
| */ | ||
| diffNow(unit?: DurationUnits, options?: DiffOptions): Duration; | ||
| /** | ||
| * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time | ||
| * @example | ||
| * DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' | ||
| * @example | ||
| * DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' | ||
| * @example | ||
| * DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays | ||
| * @example | ||
| * DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' | ||
| * @example | ||
| * DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' | ||
| */ | ||
| endOf(unit: DurationUnit): DateTime; | ||
| /** | ||
| * Equality check | ||
| * Two DateTimes are equal if they represent the same millisecond, have the same zone and location, and are both valid. | ||
| * To compare just the millisecond values, use `+dt1 === +dt2`. | ||
| */ | ||
| equals(other: DateTime): boolean; | ||
| /** | ||
| * Get the value of unit. | ||
| * @example | ||
| * DateTime.local(2017, 7, 4).get('month'); //=> 7 | ||
| * @example | ||
| * DateTime.local(2017, 7, 4).get('day'); //=> 4 | ||
| */ | ||
| get(unit: keyof DateTime): number; | ||
| /** | ||
| * Return whether this DateTime is in the same unit of time as another DateTime. | ||
| * Higher-order units must also be identical for this function to return `true`. | ||
| * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link setZone} to convert one of the dates if needed. | ||
| * @example | ||
| * DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day | ||
| */ | ||
| hasSame(other: DateTime, unit: DurationUnit): boolean; | ||
| /** | ||
| * Subtract a period of time to this DateTime and return the resulting DateTime | ||
| * See {@link plus} | ||
| */ | ||
| minus(duration: DurationInput): DateTime; | ||
| /** | ||
| * Add a period of time to this DateTime and return the resulting DateTime | ||
| * | ||
| * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. | ||
| * Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. | ||
| * Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. | ||
| * @example | ||
| * DateTime.now().plus(123) //~> in 123 milliseconds | ||
| * @example | ||
| * DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes | ||
| * @example | ||
| * DateTime.now().plus({ days: 1 }) //~> this time tomorrow | ||
| * @example | ||
| * DateTime.now().plus({ days: -1 }) //~> this time yesterday | ||
| * @example | ||
| * DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min | ||
| * @example | ||
| * DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min | ||
| */ | ||
| plus(duration: DurationInput): DateTime; | ||
| /** | ||
| * "Set" the locale options. Returns a newly-constructed DateTime. | ||
| */ | ||
| reconfigure(properties: LocaleOptions): DateTime; | ||
| /** | ||
| * Returns the resolved Intl options for this DateTime. | ||
| * This is useful in understanding the behavior of formatting methods | ||
| */ | ||
| resolvedLocaleOpts(options?: LocaleOptions & DateTimeFormatOptions): Intl.ResolvedDateTimeFormatOptions; | ||
| /** | ||
| * "Set" the values of specified units. Returns a newly-constructed DateTime. | ||
| * You can only set units with this method; for setting metadata, see {@link reconfigure} and {@link setZone}. | ||
| */ | ||
| set(values: DateObjectUnits): DateTime; | ||
| /** | ||
| * "Set" the locale. Returns a newly-constructed DateTime. | ||
| * Just a convenient alias for reconfigure({ locale }) | ||
| */ | ||
| setLocale(locale: string): DateTime; | ||
| /** | ||
| * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. | ||
| * | ||
| * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will | ||
| * report different local times and consider DSTs when making computations, as with {@link plus}. | ||
| * You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. | ||
| * | ||
| * @param zone - a zone identifier. As a string, that can be any IANA zone supported by the host environment, | ||
| * or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. | ||
| * You may also supply an instance of a {@link Zone} class. | ||
| * @param [options] - options | ||
| */ | ||
| setZone(zone: string | Zone, options?: ZoneOptions): DateTime; | ||
| /** | ||
| * "Set" this DateTime to the beginning of a unit of time. | ||
| * @example | ||
| * DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' | ||
| * @example | ||
| * DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' | ||
| * @example | ||
| * DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays | ||
| * @example | ||
| * DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' | ||
| * @example | ||
| * DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' | ||
| */ | ||
| startOf(unit: DurationUnit): DateTime; | ||
| /** | ||
| * Returns a BSON serializable equivalent to this DateTime. | ||
| */ | ||
| toBSON(): Date; | ||
| /** | ||
| * Returns a string representation of this DateTime formatted according to the specified format string. | ||
| * | ||
| * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. | ||
| * | ||
| * For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). | ||
| * | ||
| * Defaults to en-US if no locale has been specified, regardless of the system's locale. | ||
| * | ||
| * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens | ||
| * @example | ||
| * DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' | ||
| * @example | ||
| * DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' | ||
| * @example | ||
| * DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' | ||
| * @example | ||
| * DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' | ||
| */ | ||
| toFormat(format: string, options?: LocaleOptions & DateTimeFormatOptions): string; | ||
| /** | ||
| * Returns a string representation of this DateTime appropriate for use in HTTP headers. | ||
| * Specifically, the string conforms to RFC 1123. | ||
| * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 | ||
| * @example | ||
| * DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' | ||
| * @example | ||
| * DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' | ||
| */ | ||
| toHTTP(): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this DateTime | ||
| * @example | ||
| * DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' | ||
| * @example | ||
| * DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' | ||
| * @example | ||
| * DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' | ||
| * @example | ||
| * DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' | ||
| */ | ||
| toISO(options?: ToISOTimeOptions): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this DateTime's date component | ||
| * @example | ||
| * DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' | ||
| * @example | ||
| * DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' | ||
| */ | ||
| toISODate(options?: ToISODateOptions): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this DateTime's time component | ||
| * @example | ||
| * DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' | ||
| * @example | ||
| * DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' | ||
| * @example | ||
| * DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' | ||
| * @example | ||
| * DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' | ||
| */ | ||
| toISOTime(options?: ToISOTimeOptions): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this DateTime's week date | ||
| * @example | ||
| * DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' | ||
| */ | ||
| toISOWeekDate(): string; | ||
| /** | ||
| * Returns a JavaScript Date equivalent to this DateTime. | ||
| */ | ||
| toJSDate(): Date; | ||
| /** | ||
| * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. | ||
| * Called implicitly via {@link JSON.stringify} | ||
| */ | ||
| toJSON(): string; | ||
| /** | ||
| * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. | ||
| * | ||
| * Equivalent to {@link setZone}('local') | ||
| */ | ||
| toLocal(): DateTime; | ||
| /** | ||
| * Returns an array of format "parts", meaning individual tokens along with metadata. | ||
| * This is allows callers to post-process individual sections of the formatted output. | ||
| * Defaults to the system's locale if no locale has been specified | ||
| * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts | ||
| * @example | ||
| * DateTime.now().toLocaleParts(); //=> [ | ||
| * //=> { type: 'day', value: '25' }, | ||
| * //=> { type: 'literal', value: '/' }, | ||
| * //=> { type: 'month', value: '05' }, | ||
| * //=> { type: 'literal', value: '/' }, | ||
| * //=> { type: 'year', value: '1982' } | ||
| * //=> ] | ||
| */ | ||
| toLocaleParts(options?: LocaleOptions & DateTimeFormatOptions): any[]; | ||
| /** | ||
| * Returns a localized string representing this date. | ||
| * Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. | ||
| * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation | ||
| * of the DateTime in the assigned locale. | ||
| * Defaults to the system's locale if no locale has been specified | ||
| * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat | ||
| * @example | ||
| * DateTime.now().toLocaleString(); //=> 4/20/2017 | ||
| * @example | ||
| * DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' | ||
| * @example | ||
| * DateTime.now().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' | ||
| * @example | ||
| * DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' | ||
| * @example | ||
| * DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' | ||
| * @example | ||
| * DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' | ||
| * @example | ||
| * DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' | ||
| * @example | ||
| * DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' | ||
| * @example | ||
| * DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' | ||
| */ | ||
| toLocaleString(options?: LocaleOptions & DateTimeFormatOptions): string; | ||
| /** | ||
| * Returns the epoch milliseconds of this DateTime. | ||
| */ | ||
| toMillis(): number; | ||
| /** | ||
| * Returns a JavaScript object with this DateTime's year, month, day, and so on. | ||
| * @example | ||
| * DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } | ||
| */ | ||
| toObject(options?: { | ||
| /** | ||
| * Include configuration attributes in the output | ||
| * @default false | ||
| */ | ||
| includeConfig?: boolean | ||
| }): DateObject; | ||
| /** | ||
| * Returns a string representation of a this time relative to now, such as "in two days". | ||
| * Can only internationalize if your platform supports Intl.RelativeTimeFormat. Rounds down by default. | ||
| * @example | ||
| * DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" | ||
| * @example | ||
| * DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" | ||
| * @example | ||
| * DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" | ||
| * @example | ||
| * DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" | ||
| * @example | ||
| * DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" | ||
| * @example | ||
| * DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" | ||
| */ | ||
| toRelative(options?: ToRelativeOptions): string | null; | ||
| /** | ||
| * Returns a string representation of this date relative to today, such as "yesterday" or "next month". | ||
| * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. | ||
| * @example | ||
| * DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" | ||
| * @example | ||
| * DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> "mañana" | ||
| * @example | ||
| * DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" | ||
| * @example | ||
| * DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" | ||
| */ | ||
| toRelativeCalendar(options?: ToRelativeCalendarOptions): string | null; | ||
| /** | ||
| * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC | ||
| * @example | ||
| * DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' | ||
| * @example | ||
| * DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' | ||
| */ | ||
| toRFC2822(): string; | ||
| /** | ||
| * Returns the epoch seconds of this DateTime. | ||
| */ | ||
| toSeconds(): number; | ||
| /** | ||
| * Returns a string representation of this DateTime appropriate for use in SQL DateTime | ||
| * @example | ||
| * DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' | ||
| * @example | ||
| * DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' | ||
| * @example | ||
| * DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' | ||
| * @example | ||
| * DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' | ||
| */ | ||
| toSQL(options?: ToSQLOptions): string; | ||
| /** | ||
| * Returns a string representation of this DateTime appropriate for use in SQL Date | ||
| * @example | ||
| * DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' | ||
| */ | ||
| toSQLDate(): string; | ||
| /** | ||
| * Returns a string representation of this DateTime appropriate for use in SQL Time | ||
| * @example | ||
| * DateTime.utc().toSQL() //=> '05:15:16.345' | ||
| * @example | ||
| * DateTime.now().toSQL() //=> '05:15:16.345 -04:00' | ||
| * @example | ||
| * DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' | ||
| * @example | ||
| * DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' | ||
| */ | ||
| toSQLTime(options?: ToSQLOptions): string; | ||
| /** | ||
| * Returns a string representation of this DateTime appropriate for debugging | ||
| */ | ||
| toString(): string; | ||
| /** | ||
| * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. | ||
| * | ||
| * Equivalent to {@link setZone}('utc') | ||
| * @param [offset=0] - optionally, an offset from UTC in minutes | ||
| * @param [options] - options to pass to `setZone()` | ||
| */ | ||
| toUTC(offset?: number, options?: ZoneOptions): DateTime; | ||
| /** | ||
| * Return an Interval spanning between this DateTime and another DateTime | ||
| */ | ||
| until(other: DateTime): Interval; | ||
| /** | ||
| * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} | ||
| * Called implicitly when coercing types. | ||
| */ | ||
| valueOf(): number; | ||
| } |
| import { DateTimeFormatOptions, NumberingSystem } from './misc'; | ||
| import { ConversionAccuracy } from './datetime'; | ||
| export interface DurationOptions { | ||
| locale?: string; | ||
| numberingSystem?: NumberingSystem; | ||
| conversionAccuracy?: ConversionAccuracy; | ||
| } | ||
| export interface DurationObjectUnits { | ||
| year?: number; | ||
| years?: number; | ||
| quarter?: number; | ||
| quarters?: number; | ||
| month?: number; | ||
| months?: number; | ||
| week?: number; | ||
| weeks?: number; | ||
| day?: number; | ||
| days?: number; | ||
| hour?: number; | ||
| hours?: number; | ||
| minute?: number; | ||
| minutes?: number; | ||
| second?: number; | ||
| seconds?: number; | ||
| millisecond?: number; | ||
| milliseconds?: number; | ||
| } | ||
| export interface DurationObject extends DurationObjectUnits, DurationOptions {} | ||
| export type DurationUnit = keyof DurationObjectUnits; | ||
| export type DurationUnits = DurationUnit | DurationUnit[]; | ||
| export interface DurationToFormatOptions extends DateTimeFormatOptions { | ||
| floor?: boolean; | ||
| round?: boolean; | ||
| } | ||
| export type ToISOFormat = 'basic' | 'extended'; | ||
| export interface ToISOTimeDurationOptions { | ||
| /** | ||
| * Include the `T` prefix | ||
| * @default false | ||
| */ | ||
| includePrefix?: boolean; | ||
| /** | ||
| * Exclude milliseconds from the format if they're 0 | ||
| * @default false | ||
| */ | ||
| suppressMilliseconds?: boolean; | ||
| /** | ||
| * Exclude seconds from the format if they're 0 | ||
| * @default false | ||
| */ | ||
| suppressSeconds?: boolean; | ||
| /** | ||
| * Choose between the basic and extended format | ||
| * @default 'extended' | ||
| */ | ||
| format?: ToISOFormat; | ||
| } | ||
| /** | ||
| * Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() | ||
| */ | ||
| export type DurationInput = Duration | number | DurationObject; | ||
| /** | ||
| * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". | ||
| * Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods | ||
| * for creating, parsing, interrogating, transforming, and formatting them. | ||
| * They can be used on their own or in conjunction with other Luxon types; | ||
| * for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. | ||
| * | ||
| * Here is a brief overview of commonly used methods and getters in Duration: | ||
| * | ||
| * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. | ||
| * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, | ||
| * {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. | ||
| * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. | ||
| * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, | ||
| * {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. | ||
| * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} | ||
| * | ||
| * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. | ||
| */ | ||
| export class Duration { | ||
| /** | ||
| * Create a Duration from an ISO 8601 duration string. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Durations | ||
| * @example | ||
| * Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } | ||
| * @example | ||
| * Duration.fromISO('PT23H').toObject() //=> { hours: 23 } | ||
| * @example | ||
| * Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } | ||
| */ | ||
| static fromISO(text: string, options?: DurationOptions): Duration; | ||
| /** | ||
| * Create a Duration from an ISO 8601 time string. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Times | ||
| * @example | ||
| * Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } | ||
| * @example | ||
| * Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } | ||
| * @example | ||
| * Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } | ||
| * @example | ||
| * Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } | ||
| * @example | ||
| * Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } | ||
| */ | ||
| static fromISOTime(text: string, options?: DurationOptions): Duration; | ||
| /** | ||
| * Create Duration from a number of milliseconds. | ||
| * @param count of milliseconds | ||
| * @param [options] - options for parsing | ||
| * @param [options.locale='en-US'] - the locale to use | ||
| * @param [options.numberingSystem] - the numbering system to use | ||
| * @param [options.conversionAccuracy='casual'] - the conversion system to use | ||
| */ | ||
| static fromMillis(count: number, options?: DurationOptions): Duration; | ||
| /** | ||
| * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. | ||
| * If this object is empty then a zero milliseconds duration is returned. | ||
| */ | ||
| static fromObject(obj: DurationObject): Duration; | ||
| /** | ||
| * Create an invalid Duration. | ||
| * @param reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent | ||
| * @param [explanation] - longer explanation, may include parameters and other useful debugging information | ||
| */ | ||
| static invalid(reason: string, explanation?: string): Duration; | ||
| /** | ||
| * Check if an object is a Duration. Works across context boundaries | ||
| */ | ||
| static isDuration(o: any): o is Duration; | ||
| days: number; | ||
| hours: number; | ||
| /** | ||
| * Returns an error code if this Duration became invalid, or null if the Duration is valid | ||
| */ | ||
| invalidReason: string | null; | ||
| /** | ||
| * Returns an explanation of why this Duration became invalid, or null if the Duration is valid | ||
| */ | ||
| invalidExplanation: string | null; | ||
| /** | ||
| * Returns whether the Duration is invalid. Invalid durations are returned by diff operations | ||
| * on invalid DateTimes or Intervals. | ||
| */ | ||
| isValid: boolean; | ||
| /** | ||
| * Get the locale of a Duration, such 'en-GB' | ||
| */ | ||
| locale: string; | ||
| milliseconds: number; | ||
| minutes: number; | ||
| months: number; | ||
| /** | ||
| * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration | ||
| */ | ||
| numberingSystem: string; | ||
| quarters: number; | ||
| seconds: number; | ||
| weeks: number; | ||
| years: number; | ||
| /** | ||
| * Return the length of the duration in the specified unit. | ||
| * @example | ||
| * Duration.fromObject({years: 1}).as('days') //=> 365 | ||
| * @example | ||
| * Duration.fromObject({years: 1}).as('months') //=> 12 | ||
| * @example | ||
| * Duration.fromObject({hours: 60}).as('days') //=> 2.5 | ||
| */ | ||
| as(unit: DurationUnit): number; | ||
| /** | ||
| * Equality check | ||
| * Two Durations are equal if they have the same units and the same values for each unit. | ||
| */ | ||
| equals(other: Duration): boolean; | ||
| /** | ||
| * Get the value of unit. | ||
| * @example | ||
| * Duration.fromObject({years: 2, days: 3}).years //=> 2 | ||
| * @example | ||
| * Duration.fromObject({years: 2, days: 3}).months //=> 0 | ||
| * @example | ||
| * Duration.fromObject({years: 2, days: 3}).days //=> 3 | ||
| */ | ||
| get(unit: DurationUnit): number; | ||
| /** | ||
| * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. | ||
| */ | ||
| minus(duration: DurationInput): Duration; | ||
| /** | ||
| * Return the negative of this Duration. | ||
| * @example | ||
| * Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } | ||
| */ | ||
| negate(): Duration; | ||
| /** | ||
| * Reduce this Duration to its canonical representation in its current units. | ||
| * @example | ||
| * Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } | ||
| * @example | ||
| * Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } | ||
| */ | ||
| normalize(): Duration; | ||
| /** | ||
| * Make this Duration longer by the specified amount. Return a newly-constructed Duration. | ||
| */ | ||
| plus(duration: DurationInput): Duration; | ||
| /** | ||
| * "Set" the Duration's options. Returns a newly-constructed Duration. | ||
| */ | ||
| reconfigure(options: DurationOptions): Duration; | ||
| /** | ||
| * "Set" the values of specified units. Return a newly-constructed Duration. | ||
| */ | ||
| set(values: DurationObjectUnits): Duration; | ||
| /** | ||
| * Convert this Duration into its representation in a different set of units. | ||
| * @example | ||
| * Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } | ||
| */ | ||
| shiftTo(...units: DurationUnit[]): Duration; | ||
| /** | ||
| * Scale this Duration by the specified amount. Return a newly-constructed Duration. | ||
| * @example | ||
| * Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } | ||
| * @example | ||
| * Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } | ||
| */ | ||
| mapUnits(fn: (x: number, u: DurationUnit) => number): Duration; | ||
| /** | ||
| * Returns a string representation of this Duration formatted according to the specified format string. | ||
| * | ||
| * You may use these tokens: | ||
| * * `S` for milliseconds | ||
| * * `s` for seconds | ||
| * * `m` for minutes | ||
| * * `h` for hours | ||
| * * `d` for days | ||
| * * `M` for months | ||
| * * `y` for years | ||
| * | ||
| * Notes: | ||
| * * Add padding by repeating the token, e.g. `yy` pads the years to two digits, `hhhh` pads the hours out to four digits | ||
| * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Duration's conversion accuracy setting. | ||
| * | ||
| * @param format - the format string | ||
| * @param [options] - options | ||
| * @param [options.floor=true] - floor numerical values | ||
| * @example | ||
| * Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" | ||
| * @example | ||
| * Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" | ||
| * @example | ||
| * Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" | ||
| */ | ||
| toFormat(format: string, options?: DurationToFormatOptions): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this Duration. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Durations | ||
| * @example | ||
| * Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' | ||
| * @example | ||
| * Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' | ||
| * @example | ||
| * Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' | ||
| * @example | ||
| * Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' | ||
| * @example | ||
| * Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' | ||
| */ | ||
| toISO(): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. | ||
| * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Times | ||
| * @example | ||
| * Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' | ||
| * @example | ||
| * Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' | ||
| * @example | ||
| * Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' | ||
| * @example | ||
| * Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' | ||
| * @example | ||
| * Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' | ||
| */ | ||
| toISOTime(options?: ToISOTimeDurationOptions): string; // | null | ||
| /** | ||
| * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. | ||
| * Called implicitly via {@link JSON.stringify} | ||
| */ | ||
| toJSON(): string; | ||
| /** | ||
| * Returns a milliseconds value of this Duration. | ||
| */ | ||
| toMillis(): number; | ||
| /** | ||
| * Returns a JavaScript object with this Duration's values. | ||
| * @param [options] - options for generating the object | ||
| * @param [options.includeConfig=false] - include configuration attributes in the output | ||
| * @example | ||
| * Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } | ||
| */ | ||
| toObject(options?: { | ||
| /** | ||
| * include configuration attributes in the output | ||
| */ | ||
| includeConfig?: boolean | ||
| }): DurationObject; | ||
| /** | ||
| * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. | ||
| */ | ||
| toString(): string; | ||
| /** | ||
| * Returns an milliseconds value of this Duration. Alias of {@link toMillis} | ||
| * Called implicitly when coercing types. | ||
| */ | ||
| valueOf(): number; | ||
| } |
| import { CalendarSystem, NumberingSystem, StringUnitLength, UnitLength } from './misc'; | ||
| import { Zone } from './zone'; | ||
| export interface InfoOptions { | ||
| locale?: string; | ||
| } | ||
| export interface InfoUnitOptions extends InfoOptions { | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| /** @deprecated */ | ||
| export type UnitOptions = InfoUnitOptions; | ||
| export interface InfoCalendarOptions extends InfoUnitOptions { | ||
| outputCalendar?: CalendarSystem; | ||
| } | ||
| export interface Features { | ||
| /** | ||
| * Whether this environment supports general internationalization | ||
| */ | ||
| intl: boolean; | ||
| /** | ||
| * Whether this environment supports internationalized token-based formatting/parsing | ||
| */ | ||
| intlTokens: boolean; | ||
| /** | ||
| * Whether this environment supports IANA timezones | ||
| */ | ||
| zones: boolean; | ||
| /** | ||
| * Whether this environment supports relative time formatting | ||
| */ | ||
| relative: boolean; | ||
| } | ||
| /** | ||
| * The Info "class" contains static methods for retrieving general time and date related data. | ||
| * For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, | ||
| * and for discovering which of Luxon features are available in the current environment. | ||
| */ | ||
| export namespace Info { | ||
| /** | ||
| * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. | ||
| * @param [length='short'] - the length of the era representation, such as "short" or "long". | ||
| * @param [options] - options | ||
| * @param [options.locale] - the locale code | ||
| * @example | ||
| * Info.eras() //=> [ 'BC', 'AD' ] | ||
| * @example | ||
| * Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] | ||
| * @example | ||
| * Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] | ||
| */ | ||
| function eras(length?: StringUnitLength, options?: InfoOptions): string[]; | ||
| /** | ||
| * Return the set of available features in this environment. | ||
| * Some features of Luxon are not available in all environments. | ||
| * For example, on older browsers, timezone support is not available. | ||
| * Use this function to figure out if that's the case. | ||
| * Keys: | ||
| * * `zones`: whether this environment supports IANA timezones | ||
| * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing | ||
| * * `intl`: whether this environment supports general internationalization | ||
| * * `relative`: whether this environment supports relative time formatting | ||
| */ | ||
| function features(): Features; | ||
| /** | ||
| * Return whether the specified zone contains a DST. | ||
| * @param [zone='local'] - Zone to check. Defaults to the environment's local zone. | ||
| */ | ||
| function hasDST(zone?: string | Zone): boolean; | ||
| /** | ||
| * Return whether the specified zone is a valid IANA specifier. | ||
| * @param zone - Zone to check | ||
| */ | ||
| function isValidIANAZone(zone: string): boolean; | ||
| /** | ||
| * Converts the input into a {@link Zone} instance. | ||
| * | ||
| * * If `input` is already a Zone instance, it is returned unchanged. | ||
| * * If `input` is a string containing a valid time zone name, a Zone instance | ||
| * with that name is returned. | ||
| * * If `input` is a string that doesn't refer to a known time zone, a Zone | ||
| * instance with {@link Zone.isValid} == false is returned. | ||
| * * If `input is a number, a Zone instance with the specified fixed offset | ||
| * in minutes is returned. | ||
| * * If `input` is `null` or `undefined`, the default zone is returned. | ||
| * @param [input] - the value to be converted | ||
| */ | ||
| function normalizeZone(input?: number | string | Zone): Zone; | ||
| /** | ||
| * Return an array of meridiems. | ||
| * @param [options] - options | ||
| * @param [options.locale] - the locale code | ||
| * @example | ||
| * Info.meridiems() //=> [ 'AM', 'PM' ] | ||
| * @example | ||
| * Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] | ||
| */ | ||
| function meridiems(options?: InfoOptions): string[]; | ||
| /** | ||
| * Return an array of standalone month names. | ||
| * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat | ||
| * @param [length='long'] - the length of the month representation | ||
| * @param [options] - options | ||
| * @param [options.locale] - the locale code | ||
| * @param [options.numberingSystem=null] - the numbering system | ||
| * @param [options.outputCalendar='gregory'] - the calendar | ||
| * @example | ||
| * Info.months()[0] //=> 'January' | ||
| * @example | ||
| * Info.months('short')[0] //=> 'Jan' | ||
| * @example | ||
| * Info.months('numeric')[0] //=> '1' | ||
| * @example | ||
| * Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' | ||
| * @example | ||
| * Info.months('numeric', { locale: 'ar' })[0] //=> '١' | ||
| * @example | ||
| * Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' | ||
| */ | ||
| function months(length?: UnitLength, options?: InfoCalendarOptions): string[]; | ||
| /** | ||
| * Return an array of format month names. | ||
| * Format months differ from standalone months in that they're meant to appear next to the day of the month. | ||
| * In some languages, that changes the string. | ||
| * See {@link months} | ||
| * @param [length='long'] - the length of the month representation | ||
| * @param [options] - options | ||
| * @param [options.locale] - the locale code | ||
| * @param [options.numberingSystem=null] - the numbering system | ||
| * @param [options.outputCalendar='gregory'] - the calendar | ||
| */ | ||
| function monthsFormat(length?: UnitLength, options?: InfoCalendarOptions): string[]; | ||
| /** | ||
| * Return an array of standalone week names. | ||
| * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat | ||
| * @param [length='long'] - the length of the weekday representation | ||
| * @param [options] - options | ||
| * @param [options.locale] - the locale code | ||
| * @param [options.numberingSystem=null] - the numbering system | ||
| * @example | ||
| * Info.weekdays()[0] //=> 'Monday' | ||
| * @example | ||
| * Info.weekdays('short')[0] //=> 'Mon' | ||
| * @example | ||
| * Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' | ||
| * @example | ||
| * Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' | ||
| */ | ||
| function weekdays(length?: StringUnitLength, options?: InfoUnitOptions): string[]; | ||
| /** | ||
| * Return an array of format week names. | ||
| * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. | ||
| * In some languages, that changes the string. | ||
| * See {@link weekdays} | ||
| * @param [length='long'] - the length of the weekday representation | ||
| * @param [options] - options | ||
| * @param [options.locale=null] - the locale code | ||
| * @param [options.numberingSystem=null] - the numbering system | ||
| */ | ||
| function weekdaysFormat(length?: StringUnitLength, options?: InfoUnitOptions): string[]; | ||
| } |
| import { DateTime, DateObject, DateTimeOptions, DiffOptions, ToISOTimeOptions } from './datetime'; | ||
| import { Duration, DurationInput, DurationUnit } from './duration'; | ||
| export interface IntervalObject { | ||
| start?: DateTime; | ||
| end?: DateTime; | ||
| } | ||
| export type DateInput = DateTime | DateObject | Date; | ||
| /** | ||
| * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. | ||
| * Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, | ||
| * comparing, transforming, and formatting them. | ||
| * | ||
| * Here is a brief overview of the most commonly used methods and getters in Interval: | ||
| * | ||
| * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. | ||
| * * **Accessors** Use {@link start} and {@link end} to get the start and end. | ||
| * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. | ||
| * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, | ||
| * {@link xor}, {@link union}, {@link intersection}, or {@link difference}. | ||
| * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}. | ||
| * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. | ||
| */ | ||
| export class Interval { | ||
| /** | ||
| * Create an Interval from a start DateTime and a Duration to extend to. | ||
| */ | ||
| static after(start: DateInput, duration: DurationInput): Interval; | ||
| /** | ||
| * Create an Interval from an end DateTime and a Duration to extend backwards to. | ||
| */ | ||
| static before(end: DateInput, duration: DurationInput): Interval; | ||
| /** | ||
| * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. | ||
| */ | ||
| static fromDateTimes(start: DateInput, end: DateInput): Interval; | ||
| /** | ||
| * Create an Interval from an ISO 8601 string. | ||
| * Accepts `<start>/<end>`, `<start>/<duration>`, and `<duration>/<end>` formats. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals | ||
| */ | ||
| static fromISO(text: string, options?: DateTimeOptions): Interval; | ||
| /** | ||
| * Create an invalid Interval. | ||
| * @param reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent | ||
| * @param [explanation] - longer explanation, may include parameters and other useful debugging information | ||
| */ | ||
| static invalid(reason: string, explanation?: string): Interval; | ||
| /** | ||
| * Check if an object is an Interval. Works across context boundaries | ||
| */ | ||
| static isInterval(o: any): o is Interval; | ||
| /** | ||
| * Merge an array of Intervals into a equivalent minimal set of Intervals. | ||
| * Combines overlapping and adjacent Intervals. | ||
| */ | ||
| static merge(intervals: Interval[]): Interval[]; | ||
| /** | ||
| * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. | ||
| */ | ||
| static xor(intervals: Interval[]): Interval[]; | ||
| /** | ||
| * Returns the end of the Interval | ||
| */ | ||
| end: DateTime; | ||
| /** | ||
| * Returns an error code if this Interval is invalid, or null if the Interval is valid | ||
| */ | ||
| invalidReason: string | null; | ||
| /** | ||
| * Returns an explanation of why this Interval became invalid, or null if the Interval is valid | ||
| */ | ||
| invalidExplanation: string | null; | ||
| /** | ||
| * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. | ||
| */ | ||
| isValid: boolean; | ||
| /** | ||
| * Returns the start of the Interval | ||
| */ | ||
| start: DateTime; | ||
| /** | ||
| * Return whether this Interval's start is adjacent to the specified Interval's end. | ||
| */ | ||
| abutsEnd(other: Interval): boolean; | ||
| /** | ||
| * Return whether this Interval's end is adjacent to the specified Interval's start. | ||
| */ | ||
| abutsStart(other: Interval): boolean; | ||
| /** | ||
| * Return whether this Interval contains the specified DateTime. | ||
| */ | ||
| contains(dateTime: DateTime): boolean; | ||
| /** | ||
| * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. | ||
| * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' | ||
| * asks 'what dates are included in this interval?', not 'how many days long is this interval?' | ||
| * @param [unit='milliseconds'] - the unit of time to count. | ||
| */ | ||
| count(unit?: DurationUnit): number; | ||
| /** | ||
| * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. | ||
| */ | ||
| difference(...intervals: Interval[]): Interval[]; | ||
| /** | ||
| * Split this Interval into the specified number of smaller intervals. | ||
| * @param numberOfParts - The number of Intervals to divide the Interval into. | ||
| */ | ||
| divideEqually(numberOfParts: number): Interval[]; | ||
| /** | ||
| * Return whether this Interval engulfs the start and end of the specified Interval. | ||
| */ | ||
| engulfs(other: Interval): boolean; | ||
| /** | ||
| * Return whether this Interval has the same start and end as the specified Interval. | ||
| * Two DateTimes are equal if they represent the same millisecond, have the same zone and location, and are both valid. | ||
| */ | ||
| equals(other: Interval): boolean; | ||
| /** | ||
| * Returns whether this Interval's start and end are both in the same unit of time | ||
| * @param unit - the unit of time to check sameness on | ||
| */ | ||
| hasSame(unit: DurationUnit): boolean; | ||
| /** | ||
| * Return an Interval representing the intersection of this Interval and the specified Interval. | ||
| * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. | ||
| * Returns null if the intersection is empty, meaning, the intervals don't intersect. | ||
| */ | ||
| intersection(other: Interval): Interval | null; | ||
| /** | ||
| * Return whether this Interval's start is after the specified DateTime. | ||
| */ | ||
| isAfter(dateTime: DateTime): boolean; | ||
| /** | ||
| * Return whether this Interval's end is before the specified DateTime. | ||
| */ | ||
| isBefore(dateTime: DateTime): boolean; | ||
| /** | ||
| * Return whether this Interval has the same start and end DateTimes. | ||
| */ | ||
| isEmpty(): boolean; | ||
| /** | ||
| * Returns the length of the Interval in the specified unit. | ||
| * @param [unit='milliseconds'] - the unit to return the length in. | ||
| */ | ||
| length(unit?: DurationUnit): number; | ||
| /** | ||
| * Return whether this Interval overlaps with the specified Interval | ||
| */ | ||
| overlaps(other: Interval): boolean; | ||
| /** | ||
| * "Sets" the start and/or end dates. Returns a newly-constructed Interval. | ||
| */ | ||
| set(values?: IntervalObject): Interval; | ||
| /** | ||
| * Split this Interval at each of the specified DateTimes | ||
| */ | ||
| splitAt(...dateTimes: DateTime[]): Interval[]; | ||
| /** | ||
| * Split this Interval into smaller Intervals, each of the specified length. | ||
| * Left over time is grouped into a smaller interval | ||
| * @param duration - The length of each resulting interval. | ||
| */ | ||
| splitBy(duration: DurationInput): Interval[]; | ||
| /** | ||
| * Return a Duration representing the time spanned by this interval. | ||
| * @param [unit=['milliseconds']] - the unit or units to include in the duration. | ||
| * @param [options] - options that affect the creation of the Duration | ||
| * @param [options.conversionAccuracy='casual'] - the conversion system to use | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } | ||
| */ | ||
| toDuration(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration; | ||
| /** | ||
| * Returns a string representation of this Interval formatted according to the specified format string. | ||
| * @param dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. | ||
| * @param [options] - options | ||
| * @param [options.separator=' - '] - a separator to place between the start and end representations | ||
| */ | ||
| toFormat( | ||
| dateFormat: string, | ||
| options?: { | ||
| separator?: string; | ||
| }, | ||
| ): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of this Interval. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals | ||
| */ | ||
| toISO(options?: ToISOTimeOptions): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of date of this Interval. | ||
| * The time components are ignored. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals | ||
| */ | ||
| toISODate(): string; | ||
| /** | ||
| * Returns an ISO 8601-compliant string representation of time of this Interval. | ||
| * The date components are ignored. | ||
| * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals | ||
| */ | ||
| toISOTime(options?: ToISOTimeOptions): string; | ||
| /** | ||
| * Returns a string representation of this Interval appropriate for debugging. | ||
| */ | ||
| toString(): string; | ||
| /** | ||
| * Return an Interval representing the union of this Interval and the specified Interval. | ||
| * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. | ||
| */ | ||
| union(other: Interval): Interval; | ||
| /** | ||
| * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) | ||
| * @example | ||
| * Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) | ||
| */ | ||
| mapEndpoints(mapFn: (d: DateTime) => DateTime): Interval; | ||
| } |
| export const VERSION: string; | ||
| export * from './datetime'; | ||
| export * from './duration'; | ||
| export * from './info'; | ||
| export * from './interval'; | ||
| export * from './settings'; | ||
| export * from './zone'; | ||
| export * from './misc'; |
| export type DateTimeFormatOptions = Intl.DateTimeFormatOptions; | ||
| export interface ZoneOptions { | ||
| /** | ||
| * If true, adjust the underlying time so that the local time stays the same, but in the target zone. | ||
| * You should rarely need this. | ||
| * Defaults to false. | ||
| */ | ||
| keepLocalTime?: boolean; | ||
| /** | ||
| * @deprecated since 0.2.12. Use keepLocalTime instead | ||
| */ | ||
| keepCalendarTime?: boolean; | ||
| } | ||
| /** @deprecated */ | ||
| export type EraLength = StringUnitLength; | ||
| export type NumberingSystem = Intl.DateTimeFormatOptions extends { numberingSystem?: infer T } ? T : | ||
| | 'arab' | ||
| | 'arabext' | ||
| | 'bali' | ||
| | 'beng' | ||
| | 'deva' | ||
| | 'fullwide' | ||
| | 'gujr' | ||
| | 'guru' | ||
| | 'hanidec' | ||
| | 'khmr' | ||
| | 'knda' | ||
| | 'laoo' | ||
| | 'latn' | ||
| | 'limb' | ||
| | 'mlym' | ||
| | 'mong' | ||
| | 'mymr' | ||
| | 'orya' | ||
| | 'tamldec' | ||
| | 'telu' | ||
| | 'thai' | ||
| | 'tibt'; | ||
| export type CalendarSystem = Intl.DateTimeFormatOptions extends { calendar?: infer T } ? T : | ||
| | 'buddhist' | ||
| | 'chinese' | ||
| | 'coptic' | ||
| | 'ethioaa' | ||
| | 'ethiopic' | ||
| | 'gregory' | ||
| | 'hebrew' | ||
| | 'indian' | ||
| | 'islamic' | ||
| | 'islamicc' | ||
| | 'iso8601' | ||
| | 'japanese' | ||
| | 'persian' | ||
| | 'roc'; | ||
| export type HourCycle = 'h11' | 'h12' | 'h23' | 'h24'; | ||
| export type StringUnitLength = 'narrow' | 'short' | 'long'; | ||
| export type NumberUnitLength = 'numeric' | '2-digit'; | ||
| export type UnitLength = StringUnitLength | NumberUnitLength; |
| import { Zone } from './zone'; | ||
| /** | ||
| * Settings contains static getters and setters that control Luxon's overall behavior. | ||
| * Luxon is a simple library with few options, but the ones it does have live here. | ||
| */ | ||
| export namespace Settings { | ||
| /** | ||
| * The current function for returning the current timestamp. | ||
| * The function should return a number, which will be interpreted as an Epoch millisecond count | ||
| * @example | ||
| * Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future | ||
| * @example | ||
| * Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time | ||
| */ | ||
| function now(): number; | ||
| /** | ||
| * The default time zone to create DateTimes in. Does not affect existing instances. | ||
| * Set this to change {@link defaultZone} | ||
| */ | ||
| let defaultZoneName: string; | ||
| /** | ||
| * The default time zone object to create DateTimes in. Does not affect existing instances. | ||
| * Change by setting {@link defaultZoneName} | ||
| */ | ||
| const defaultZone: Zone; | ||
| /** | ||
| * The default locale to create DateTimes with. Does not affect existing instances. | ||
| */ | ||
| let defaultLocale: string; | ||
| /** | ||
| * The default numbering system to create DateTimes with. Does not affect existing instances. | ||
| */ | ||
| let defaultNumberingSystem: string; | ||
| /** | ||
| * The default output calendar to create DateTimes with. Does not affect existing instances. | ||
| */ | ||
| let defaultOutputCalendar: string; | ||
| /** | ||
| * Whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals | ||
| */ | ||
| let throwOnInvalid: boolean; | ||
| /** | ||
| * Reset Luxon's global caches. Should only be necessary in testing scenarios. | ||
| */ | ||
| function resetCaches(): void; | ||
| } |
| export interface ZoneOffsetOptions { | ||
| /** | ||
| * What style of offset to return. | ||
| */ | ||
| format?: 'short' | 'long'; | ||
| /** | ||
| * What locale to return the offset name in. | ||
| */ | ||
| locale?: string; | ||
| } | ||
| /** | ||
| * What style of offset to return. | ||
| * Returning '+6', '+06:00', or '+0600' respectively | ||
| */ | ||
| export type ZoneOffsetFormat = | 'narrow' | 'short' | 'techie'; | ||
| export class Zone { | ||
| /** | ||
| * The type of zone | ||
| */ | ||
| type: string; | ||
| /** | ||
| * The name of this zone. | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Returns whether the offset is known to be fixed for the whole year. | ||
| */ | ||
| universal: boolean; | ||
| /** | ||
| * Returns the offset's common name (such as EST) at the specified timestamp | ||
| * @param ts - Epoch milliseconds for which to get the name | ||
| * @param options - Options to affect the format | ||
| * @param options.format - What style of offset to return. | ||
| * @param options.locale - What locale to return the offset name in. | ||
| */ | ||
| offsetName(ts: number, options: ZoneOffsetOptions): string; | ||
| /** | ||
| * Returns the offset's value as a string | ||
| * @param ts - Epoch milliseconds for which to get the offset | ||
| * @param format - What style of offset to return. | ||
| * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively | ||
| */ | ||
| formatOffset(ts: number, format: ZoneOffsetFormat): string; | ||
| /** | ||
| * Return the offset in minutes for this zone at the specified timestamp. | ||
| * @param ts - Epoch milliseconds for which to compute the offset | ||
| */ | ||
| offset(ts: number): number; | ||
| /** | ||
| * Return whether this Zone is equal to another zone | ||
| * @param other - the zone to compare | ||
| */ | ||
| equals(other: Zone): boolean; | ||
| /** | ||
| * Return whether this Zone is valid. | ||
| */ | ||
| isValid: boolean; | ||
| } | ||
| /** | ||
| * A zone identified by an IANA identifier, like America/New_York | ||
| */ | ||
| export class IANAZone extends Zone { | ||
| constructor(ianaString: string); | ||
| /** | ||
| * Same as constructor but has caching. | ||
| */ | ||
| static create(ianaString: string): IANAZone; | ||
| /** | ||
| * Returns whether the provided string is a valid specifier. | ||
| * This only checks the string's format, not that the specifier | ||
| * identifies a known zone; see {@link isValidZone} for that. | ||
| * | ||
| * @param s - The string to check validity on | ||
| * @example | ||
| * IANAZone.isValidSpecifier("America/New_York") //=> true | ||
| * @example | ||
| * IANAZone.isValidSpecifier("Fantasia/Castle") //=> true | ||
| * @example | ||
| * IANAZone.isValidSpecifier("Sport~~blorp") //=> false | ||
| */ | ||
| static isValidSpecifier(s: string): boolean; | ||
| /** | ||
| * Returns whether the provided string identifies a real zone | ||
| * @param zone - The string to check | ||
| * @example | ||
| * IANAZone.isValidZone("America/New_York") //=> true | ||
| * @example | ||
| * IANAZone.isValidZone("Fantasia/Castle") //=> false | ||
| * @example | ||
| * IANAZone.isValidZone("Sport~~blorp") //=> false | ||
| */ | ||
| static isValidZone(zone: string): boolean; | ||
| /** | ||
| * Reset local caches. Should only be necessary in testing scenarios. | ||
| */ | ||
| static resetCache(): void; | ||
| } | ||
| /** | ||
| * A zone with a fixed offset (meaning no DST) | ||
| */ | ||
| export class FixedOffsetZone extends Zone { | ||
| /** | ||
| * Get a singleton instance of UTC | ||
| */ | ||
| static utcInstance: FixedOffsetZone; | ||
| /** | ||
| * Get an instance with a specified offset | ||
| * @param offset - The offset in minutes | ||
| */ | ||
| static instance(offset: number): FixedOffsetZone; | ||
| /** | ||
| * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" | ||
| * @param s - The offset string to parse | ||
| * @example | ||
| * FixedOffsetZone.parseSpecifier("UTC+6") | ||
| * @example | ||
| * FixedOffsetZone.parseSpecifier("UTC+06") | ||
| * @example | ||
| * FixedOffsetZone.parseSpecifier("UTC-6:00") | ||
| */ | ||
| static parseSpecifier(s: string): FixedOffsetZone; | ||
| } | ||
| /** | ||
| * A zone that failed to parse. You should never need to instantiate this. | ||
| */ | ||
| export class InvalidZone extends Zone { } | ||
| /** | ||
| * Represents the local zone for this JavaScript environment. | ||
| */ | ||
| export class LocalZone extends Zone { | ||
| /** | ||
| * Get a singleton instance of the local zone | ||
| */ | ||
| static instance: LocalZone; | ||
| } |
+2
-581
@@ -12,584 +12,5 @@ // Type definitions for luxon 1.26 | ||
| // Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
| // Carson Full <https://github.com/carsonf> | ||
| // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
| export const VERSION: string; | ||
| export type DateTimeFormatOptions = Intl.DateTimeFormatOptions; | ||
| export interface ZoneOptions { | ||
| keepLocalTime?: boolean; | ||
| /** | ||
| * @deprecated since 0.2.12. Use keepLocalTime instead | ||
| */ | ||
| keepCalendarTime?: boolean; | ||
| } | ||
| export type ToRelativeUnit = | ||
| | 'years' | ||
| | 'quarters' | ||
| | 'months' | ||
| | 'weeks' | ||
| | 'days' | ||
| | 'hours' | ||
| | 'minutes' | ||
| | 'seconds'; | ||
| export interface ToRelativeOptions { | ||
| /** The DateTime to use as the basis to which this time is compared. Defaults to now. */ | ||
| base?: DateTime; | ||
| locale?: string; | ||
| style?: StringUnitLength; | ||
| /** If omitted, the method will pick the unit. */ | ||
| unit?: ToRelativeUnit; | ||
| /** Defaults to `true`. */ | ||
| round?: boolean; | ||
| /** | ||
| * Padding in milliseconds. This allows you to round up the result if it fits inside the threshold. | ||
| * Don't use in combination with {round: false} because the decimal output will include the padding. | ||
| * Defaults to 0. | ||
| */ | ||
| padding?: number; | ||
| /** The Intl system may choose not to honor this */ | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| export interface ToRelativeCalendarOptions { | ||
| /** The DateTime to use as the basis to which this time is compared. Defaults to now. */ | ||
| base?: DateTime; | ||
| locale?: string; | ||
| /** If omitted, the method will pick the unit. */ | ||
| unit?: ToRelativeUnit; | ||
| /** The Intl system may choose not to honor this. */ | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| export interface ToSQLOptions { | ||
| includeOffset?: boolean; | ||
| includeZone?: boolean; | ||
| } | ||
| export type ToISOFormat = 'basic' | 'extended'; | ||
| export interface ToISOTimeDurationOptions { | ||
| /** | ||
| * @default false | ||
| */ | ||
| includePrefix?: boolean; | ||
| /** | ||
| * @default false | ||
| */ | ||
| suppressMilliseconds?: boolean; | ||
| /** | ||
| * @default false | ||
| */ | ||
| suppressSeconds?: boolean; | ||
| /** | ||
| * choose between the basic and extended format | ||
| * @default 'extended' | ||
| */ | ||
| format?: ToISOFormat; | ||
| } | ||
| export interface ToISOTimeOptions { | ||
| /** | ||
| * @default true | ||
| */ | ||
| includeOffset?: boolean; | ||
| /** | ||
| * @default false | ||
| */ | ||
| suppressMilliseconds?: boolean; | ||
| /** | ||
| * @default false | ||
| */ | ||
| suppressSeconds?: boolean; | ||
| /** | ||
| * choose between the basic and extended format | ||
| * @default 'extended' | ||
| */ | ||
| format?: ToISOFormat; | ||
| } | ||
| export interface ToISODateOptions { | ||
| /** | ||
| * choose between the basic and extended format | ||
| * @default 'extended' | ||
| */ | ||
| format?: ToISOFormat; | ||
| } | ||
| // alias for backwards compatibility | ||
| export type ISOTimeOptions = ToISOTimeOptions; | ||
| export interface LocaleOptions { | ||
| locale?: string; | ||
| outputCalendar?: CalendarSystem; | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| export interface DateTimeOptions extends LocaleOptions { | ||
| zone?: string | Zone; | ||
| setZone?: boolean; | ||
| } | ||
| export interface DateTimeJSOptions extends LocaleOptions { | ||
| zone?: string | Zone; | ||
| } | ||
| export interface DateObjectUnits { | ||
| year?: number; | ||
| month?: number; | ||
| day?: number; | ||
| ordinal?: number; | ||
| weekYear?: number; | ||
| weekNumber?: number; | ||
| weekday?: number; | ||
| hour?: number; | ||
| minute?: number; | ||
| second?: number; | ||
| millisecond?: number; | ||
| } | ||
| export interface DateObject extends DateObjectUnits, LocaleOptions { | ||
| zone?: string | Zone; | ||
| } | ||
| export type ConversionAccuracy = 'casual' | 'longterm'; | ||
| export interface DiffOptions { | ||
| conversionAccuracy?: ConversionAccuracy; | ||
| } | ||
| export interface ExplainedFormat { | ||
| input: string; | ||
| tokens: Array<{ literal: boolean; val: string }>; | ||
| regex?: RegExp; | ||
| rawMatches?: RegExpMatchArray | null; | ||
| matches?: { [k: string]: any }; | ||
| result?: { [k: string]: any } | null; | ||
| zone?: Zone | null; | ||
| invalidReason?: string; | ||
| } | ||
| export class DateTime { | ||
| static readonly DATETIME_FULL: DateTimeFormatOptions; | ||
| static readonly DATETIME_FULL_WITH_SECONDS: DateTimeFormatOptions; | ||
| static readonly DATETIME_HUGE: DateTimeFormatOptions; | ||
| static readonly DATETIME_HUGE_WITH_SECONDS: DateTimeFormatOptions; | ||
| static readonly DATETIME_MED: DateTimeFormatOptions; | ||
| static readonly DATETIME_MED_WITH_SECONDS: DateTimeFormatOptions; | ||
| static readonly DATETIME_MED_WITH_WEEKDAY: DateTimeFormatOptions; | ||
| static readonly DATETIME_SHORT: DateTimeFormatOptions; | ||
| static readonly DATETIME_SHORT_WITH_SECONDS: DateTimeFormatOptions; | ||
| static readonly DATE_FULL: DateTimeFormatOptions; | ||
| static readonly DATE_HUGE: DateTimeFormatOptions; | ||
| static readonly DATE_MED: DateTimeFormatOptions; | ||
| static readonly DATE_MED_WITH_WEEKDAY: DateTimeFormatOptions; | ||
| static readonly DATE_SHORT: DateTimeFormatOptions; | ||
| static readonly TIME_24_SIMPLE: DateTimeFormatOptions; | ||
| static readonly TIME_24_WITH_LONG_OFFSET: DateTimeFormatOptions; | ||
| static readonly TIME_24_WITH_SECONDS: DateTimeFormatOptions; | ||
| static readonly TIME_24_WITH_SHORT_OFFSET: DateTimeFormatOptions; | ||
| static readonly TIME_SIMPLE: DateTimeFormatOptions; | ||
| static readonly TIME_WITH_LONG_OFFSET: DateTimeFormatOptions; | ||
| static readonly TIME_WITH_SECONDS: DateTimeFormatOptions; | ||
| static readonly TIME_WITH_SHORT_OFFSET: DateTimeFormatOptions; | ||
| static fromHTTP(text: string, options?: DateTimeOptions): DateTime; | ||
| static fromISO(text: string, options?: DateTimeOptions): DateTime; | ||
| static fromJSDate(date: Date, options?: DateTimeJSOptions): DateTime; | ||
| static fromMillis(ms: number, options?: DateTimeOptions): DateTime; | ||
| static fromObject(obj: DateObject): DateTime; | ||
| static fromRFC2822(text: string, options?: DateTimeOptions): DateTime; | ||
| static fromSeconds(seconds: number, options?: DateTimeOptions): DateTime; | ||
| static fromSQL(text: string, options?: DateTimeOptions): DateTime; | ||
| static fromFormat(text: string, format: string, opts?: DateTimeOptions): DateTime; | ||
| static fromFormatExplain(text: string, format: string, opts?: DateTimeOptions): ExplainedFormat; | ||
| /** | ||
| * @deprecated since 0.3.0. Use fromFormat instead | ||
| */ | ||
| static fromString(text: string, format: string, options?: DateTimeOptions): DateTime; | ||
| /** | ||
| * @deprecated 0.3.0. Use fromFormatExplain instead | ||
| */ | ||
| static fromStringExplain( | ||
| text: string, | ||
| format: string, | ||
| options?: DateTimeOptions, | ||
| ): ExplainedFormat; | ||
| /** | ||
| * Create an invalid DateTime. | ||
| * @param reason - simple string of why this DateTime is invalid. | ||
| * Should not contain parameters or anything else data-dependent | ||
| * @param [explanation=null] - longer explanation, may include parameters and other useful debugging information | ||
| */ | ||
| static invalid(reason: string, explanation?: string): DateTime; | ||
| static isDateTime(o: any): o is DateTime; | ||
| static local( | ||
| year?: number, | ||
| month?: number, | ||
| day?: number, | ||
| hour?: number, | ||
| minute?: number, | ||
| second?: number, | ||
| millisecond?: number, | ||
| ): DateTime; | ||
| static max(): undefined; | ||
| static max(...dateTimes: DateTime[]): DateTime; | ||
| static min(): undefined; | ||
| static min(...dateTimes: DateTime[]): DateTime; | ||
| static now(): DateTime; | ||
| static utc( | ||
| year?: number, | ||
| month?: number, | ||
| day?: number, | ||
| hour?: number, | ||
| minute?: number, | ||
| second?: number, | ||
| millisecond?: number, | ||
| ): DateTime; | ||
| day: number; | ||
| daysInMonth: number; | ||
| daysInYear: number; | ||
| hour: number; | ||
| invalidReason: string | null; | ||
| invalidExplanation: string | null; | ||
| isInDST: boolean; | ||
| isInLeapYear: boolean; | ||
| isOffsetFixed: boolean; | ||
| isValid: boolean; | ||
| locale: string; | ||
| millisecond: number; | ||
| minute: number; | ||
| month: number; | ||
| monthLong: string; | ||
| monthShort: string; | ||
| numberingSystem: string; | ||
| offset: number; | ||
| offsetNameLong: string; | ||
| offsetNameShort: string; | ||
| ordinal: number; | ||
| outputCalendar: string; | ||
| quarter: number; | ||
| second: number; | ||
| weekNumber: number; | ||
| weekYear: number; | ||
| weekday: number; | ||
| weekdayLong: string; | ||
| weekdayShort: string; | ||
| weeksInWeekYear: number; | ||
| year: number; | ||
| zoneName: string; | ||
| zone: Zone; | ||
| diff(other: DateTime, unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration; | ||
| diffNow(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration; | ||
| endOf(unit: DurationUnit): DateTime; | ||
| equals(other: DateTime): boolean; | ||
| get(unit: keyof DateTime): number; | ||
| hasSame(other: DateTime, unit: DurationUnit): boolean; | ||
| minus(duration: Duration | number | DurationObject): DateTime; | ||
| plus(duration: Duration | number | DurationObject): DateTime; | ||
| reconfigure(properties: LocaleOptions): DateTime; | ||
| resolvedLocaleOpts(options?: LocaleOptions & DateTimeFormatOptions): Intl.ResolvedDateTimeFormatOptions; | ||
| set(values: DateObjectUnits): DateTime; | ||
| setLocale(locale: string): DateTime; | ||
| setZone(zone: string | Zone, options?: ZoneOptions): DateTime; | ||
| startOf(unit: DurationUnit): DateTime; | ||
| toBSON(): Date; | ||
| toFormat(format: string, options?: LocaleOptions & DateTimeFormatOptions): string; | ||
| toHTTP(): string; | ||
| toISO(options?: ToISOTimeOptions): string; | ||
| /** Returns an ISO 8601-compliant string representation of this DateTime's date component */ | ||
| toISODate(options?: ToISODateOptions): string; | ||
| toISOTime(options?: ToISOTimeOptions): string; | ||
| toISOWeekDate(): string; | ||
| toJSDate(): Date; | ||
| toJSON(): string; | ||
| toLocal(): DateTime; | ||
| toLocaleParts(options?: LocaleOptions & DateTimeFormatOptions): any[]; | ||
| toLocaleString(options?: LocaleOptions & DateTimeFormatOptions): string; | ||
| toMillis(): number; | ||
| toObject(options?: { includeConfig?: boolean }): DateObject; | ||
| toRelative(options?: ToRelativeOptions): string | null; | ||
| toRelativeCalendar(options?: ToRelativeCalendarOptions): string | null; | ||
| toRFC2822(): string; | ||
| toSeconds(): number; | ||
| toSQL(options?: ToSQLOptions): string; | ||
| toSQLDate(): string; | ||
| toSQLTime(options?: ToSQLOptions): string; | ||
| toString(): string; | ||
| toUTC(offset?: number, options?: ZoneOptions): DateTime; | ||
| until(other: DateTime): Interval; | ||
| valueOf(): number; | ||
| } | ||
| export interface DurationOptions { | ||
| locale?: string; | ||
| numberingSystem?: NumberingSystem; | ||
| conversionAccuracy?: ConversionAccuracy; | ||
| } | ||
| export interface DurationObjectUnits { | ||
| year?: number; | ||
| years?: number; | ||
| quarter?: number; | ||
| quarters?: number; | ||
| month?: number; | ||
| months?: number; | ||
| week?: number; | ||
| weeks?: number; | ||
| day?: number; | ||
| days?: number; | ||
| hour?: number; | ||
| hours?: number; | ||
| minute?: number; | ||
| minutes?: number; | ||
| second?: number; | ||
| seconds?: number; | ||
| millisecond?: number; | ||
| milliseconds?: number; | ||
| } | ||
| export interface DurationObject extends DurationObjectUnits, DurationOptions {} | ||
| export type DurationUnit = keyof DurationObjectUnits; | ||
| export interface DurationToFormatOptions extends DateTimeFormatOptions { | ||
| floor?: boolean; | ||
| round?: boolean; | ||
| } | ||
| export class Duration { | ||
| static fromISO(text: string, options?: DurationOptions): Duration; | ||
| static fromISOTime(text: string, options?: DurationOptions): Duration; | ||
| static fromMillis(count: number, options?: DurationOptions): Duration; | ||
| static fromObject(Object: DurationObject): Duration; | ||
| static invalid(reason?: string): Duration; | ||
| static isDuration(o: any): o is Duration; | ||
| days: number; | ||
| hours: number; | ||
| invalidReason: string | null; | ||
| invalidExplanation: string | null; | ||
| isValid: boolean; | ||
| locale: string; | ||
| milliseconds: number; | ||
| minutes: number; | ||
| months: number; | ||
| numberingSystem: string; | ||
| quarters: number; | ||
| seconds: number; | ||
| weeks: number; | ||
| years: number; | ||
| as(unit: DurationUnit): number; | ||
| equals(other: Duration): boolean; | ||
| get(unit: DurationUnit): number; | ||
| minus(duration: Duration | number | DurationObject): Duration; | ||
| negate(): Duration; | ||
| normalize(): Duration; | ||
| plus(duration: Duration | number | DurationObject): Duration; | ||
| reconfigure(objectPattern: DurationOptions): Duration; | ||
| set(values: DurationObjectUnits): Duration; | ||
| shiftTo(...units: DurationUnit[]): Duration; | ||
| mapUnits(fn: (x: number, u: DurationUnit) => number): Duration; | ||
| toFormat(format: string, options?: DurationToFormatOptions): string; | ||
| toISO(): string; | ||
| toISOTime(options?: ToISOTimeDurationOptions): string; | ||
| toJSON(): string; | ||
| toMillis(): number; | ||
| toObject(options?: { includeConfig?: boolean }): DurationObject; | ||
| toString(): string; | ||
| valueOf(): number; | ||
| } | ||
| // @deprecated | ||
| export type EraLength = StringUnitLength; | ||
| export type NumberingSystem = Intl.DateTimeFormatOptions extends { numberingSystem?: infer T } ? T : | ||
| | 'arab' | ||
| | 'arabext' | ||
| | 'bali' | ||
| | 'beng' | ||
| | 'deva' | ||
| | 'fullwide' | ||
| | 'gujr' | ||
| | 'guru' | ||
| | 'hanidec' | ||
| | 'khmr' | ||
| | 'knda' | ||
| | 'laoo' | ||
| | 'latn' | ||
| | 'limb' | ||
| | 'mlym' | ||
| | 'mong' | ||
| | 'mymr' | ||
| | 'orya' | ||
| | 'tamldec' | ||
| | 'telu' | ||
| | 'thai' | ||
| | 'tibt'; | ||
| export type CalendarSystem = Intl.DateTimeFormatOptions extends { calendar?: infer T } ? T : | ||
| | 'buddhist' | ||
| | 'chinese' | ||
| | 'coptic' | ||
| | 'ethioaa' | ||
| | 'ethiopic' | ||
| | 'gregory' | ||
| | 'hebrew' | ||
| | 'indian' | ||
| | 'islamic' | ||
| | 'islamicc' | ||
| | 'iso8601' | ||
| | 'japanese' | ||
| | 'persian' | ||
| | 'roc'; | ||
| export type HourCycle = 'h11' | 'h12' | 'h23' | 'h24'; | ||
| export type StringUnitLength = 'narrow' | 'short' | 'long'; | ||
| export type NumberUnitLength = 'numeric' | '2-digit'; | ||
| export type UnitLength = StringUnitLength | NumberUnitLength; | ||
| export interface InfoOptions { | ||
| locale?: string; | ||
| } | ||
| export interface InfoUnitOptions extends InfoOptions { | ||
| numberingSystem?: NumberingSystem; | ||
| } | ||
| // @deprecated | ||
| export type UnitOptions = InfoUnitOptions; | ||
| export interface InfoCalendarOptions extends InfoUnitOptions { | ||
| outputCalendar?: CalendarSystem; | ||
| } | ||
| export interface Features { | ||
| intl: boolean; | ||
| intlTokens: boolean; | ||
| zones: boolean; | ||
| relative: boolean; | ||
| } | ||
| export namespace Info { | ||
| function eras(length?: StringUnitLength, options?: InfoOptions): string[]; | ||
| function features(): Features; | ||
| function hasDST(zone: string | Zone): boolean; | ||
| function isValidIANAZone(zone: string): boolean; | ||
| function normalizeZone(input?: number | string | Zone): Zone; | ||
| function meridiems(options?: InfoOptions): string[]; | ||
| function months(length?: UnitLength, options?: InfoCalendarOptions): string[]; | ||
| function monthsFormat(length?: UnitLength, options?: InfoCalendarOptions): string[]; | ||
| function weekdays(length?: StringUnitLength, options?: InfoUnitOptions): string[]; | ||
| function weekdaysFormat(length?: StringUnitLength, options?: InfoUnitOptions): string[]; | ||
| } | ||
| export interface IntervalObject { | ||
| start?: DateTime; | ||
| end?: DateTime; | ||
| } | ||
| export class Interval { | ||
| static after( | ||
| start: DateTime | DateObject | Date, | ||
| duration: Duration | number | DurationObject, | ||
| ): Interval; | ||
| static before( | ||
| end: DateTime | DateObject | Date, | ||
| duration: Duration | number | DurationObject, | ||
| ): Interval; | ||
| static fromDateTimes( | ||
| start: DateTime | DateObject | Date, | ||
| end: DateTime | DateObject | Date, | ||
| ): Interval; | ||
| static fromISO(string: string, options?: DateTimeOptions): Interval; | ||
| static invalid(reason?: string): Interval; | ||
| static isInterval(o: any): o is Interval; | ||
| static merge(intervals: Interval[]): Interval[]; | ||
| static xor(intervals: Interval[]): Interval[]; | ||
| end: DateTime; | ||
| invalidReason: string | null; | ||
| invalidExplanation: string | null; | ||
| isValid: boolean; | ||
| start: DateTime; | ||
| abutsEnd(other: Interval): boolean; | ||
| abutsStart(other: Interval): boolean; | ||
| contains(dateTime: DateTime): boolean; | ||
| count(unit?: DurationUnit): number; | ||
| difference(...intervals: Interval[]): Interval[]; | ||
| divideEqually(numberOfParts?: number): Interval[]; | ||
| engulfs(other: Interval): boolean; | ||
| equals(other: Interval): boolean; | ||
| hasSame(unit: DurationUnit): boolean; | ||
| intersection(other: Interval): Interval | null; | ||
| isAfter(dateTime: DateTime): boolean; | ||
| isBefore(dateTime: DateTime): boolean; | ||
| isEmpty(): boolean; | ||
| length(unit?: DurationUnit): number; | ||
| overlaps(other: Interval): boolean; | ||
| set(values: IntervalObject): Interval; | ||
| splitAt(...dateTimes: DateTime[]): Interval[]; | ||
| splitBy(duration: Duration | DurationObject | number): Interval[]; | ||
| toDuration(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration; | ||
| toFormat( | ||
| dateFormat: string, | ||
| options?: { | ||
| separator?: string; | ||
| }, | ||
| ): string; | ||
| toISO(options?: ToISOTimeOptions): string; | ||
| toISODate(): string; | ||
| toISOTime(options?: ToISOTimeOptions): string; | ||
| toString(): string; | ||
| union(other: Interval): Interval; | ||
| mapEndpoints(cb: (d: DateTime) => DateTime): Interval; | ||
| } | ||
| export namespace Settings { | ||
| let defaultLocale: string; | ||
| let defaultNumberingSystem: string; | ||
| let defaultOutputCalendar: string; | ||
| const defaultZone: Zone; | ||
| let defaultZoneName: string; | ||
| let throwOnInvalid: boolean; | ||
| function now(): number; | ||
| function resetCaches(): void; | ||
| } | ||
| export interface ZoneOffsetOptions { | ||
| format?: 'short' | 'long'; | ||
| locale?: string; | ||
| } | ||
| export type ZoneOffsetFormat = 'narrow' | 'short' | 'techie'; | ||
| export class Zone { | ||
| offsetName(ts: number, options: ZoneOffsetOptions): string; | ||
| formatOffset(ts: number, format: ZoneOffsetFormat): string; | ||
| isValid: boolean; | ||
| name: string; | ||
| type: string; | ||
| universal: boolean; | ||
| equals(other: Zone): boolean; | ||
| offset(ts: number): number; | ||
| } | ||
| export class IANAZone extends Zone { | ||
| constructor(ianaString: string); | ||
| static create(name: string): IANAZone; | ||
| static isValidSpecifier(s: string): boolean; | ||
| static isValidZone(zone: string): boolean; | ||
| static resetCache(): void; | ||
| } | ||
| export class FixedOffsetZone extends Zone { | ||
| static utcInstance: FixedOffsetZone; | ||
| static instance(offset: number): FixedOffsetZone; | ||
| static parseSpecifier(s: string): FixedOffsetZone; | ||
| } | ||
| export class InvalidZone extends Zone { } | ||
| export class LocalZone extends Zone { | ||
| static readonly instance: LocalZone; | ||
| } | ||
| export * from './src/luxon'; |
| { | ||
| "name": "@types/luxon", | ||
| "version": "1.26.3", | ||
| "version": "1.26.4", | ||
| "description": "TypeScript definitions for luxon", | ||
@@ -51,2 +51,7 @@ "license": "MIT", | ||
| "githubUsername": "peterblazejewicz" | ||
| }, | ||
| { | ||
| "name": "Carson Full", | ||
| "url": "https://github.com/carsonf", | ||
| "githubUsername": "carsonf" | ||
| } | ||
@@ -63,4 +68,4 @@ ], | ||
| "dependencies": {}, | ||
| "typesPublisherContentHash": "59bd1423643a7d896069c5415bbd1c9f8a57cd6e3dff712d64aa105744b1e4ba", | ||
| "typesPublisherContentHash": "6fcfd20e9e6ab19f4e6dd15854511177c7298ec7b8cb306fbe5ed6bc1f343d12", | ||
| "typeScriptVersion": "3.5" | ||
| } |
+2
-2
@@ -11,3 +11,3 @@ # Installation | ||
| ### Additional Details | ||
| * Last updated: Sun, 04 Apr 2021 07:01:13 GMT | ||
| * Last updated: Fri, 16 Apr 2021 19:31:18 GMT | ||
| * Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
| # Credits | ||
| These definitions were written by [Colby DeHart](https://github.com/colbydehart), [Hyeonseok Yang](https://github.com/FourwingsY), [Jonathan Siebern](https://github.com/jsiebern), [Matt R. Wilson](https://github.com/mastermatt), [Pietro Vismara](https://github.com/pietrovismara), [Janeene Beeforth](https://github.com/dawnmist), [Jason Yu](https://github.com/ycmjason), [Aitor Pérez Rodal](https://github.com/Aitor1995), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). | ||
| These definitions were written by [Colby DeHart](https://github.com/colbydehart), [Hyeonseok Yang](https://github.com/FourwingsY), [Jonathan Siebern](https://github.com/jsiebern), [Matt R. Wilson](https://github.com/mastermatt), [Pietro Vismara](https://github.com/pietrovismara), [Janeene Beeforth](https://github.com/dawnmist), [Jason Yu](https://github.com/ycmjason), [Aitor Pérez Rodal](https://github.com/Aitor1995), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Carson Full](https://github.com/carsonf). |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
86579
278.98%12
200%2002
266.67%6
500%1
Infinity%