moment.d.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. /**
  2. * @param strict Strict parsing disables the deprecated fallback to the native Date constructor when
  3. * parsing a string.
  4. */
  5. declare function moment(inp?: moment.MomentInput, strict?: boolean): moment.Moment;
  6. /**
  7. * @param strict Strict parsing requires that the format and input match exactly, including delimeters.
  8. * Strict parsing is frequently the best parsing option. For more information about choosing strict vs
  9. * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/).
  10. */
  11. declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, strict?: boolean): moment.Moment;
  12. /**
  13. * @param strict Strict parsing requires that the format and input match exactly, including delimeters.
  14. * Strict parsing is frequently the best parsing option. For more information about choosing strict vs
  15. * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/).
  16. */
  17. declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment;
  18. declare namespace moment {
  19. type RelativeTimeKey = 's' | 'ss' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'w' | 'M' | 'MM' | 'y' | 'yy';
  20. type CalendarKey = 'sameDay' | 'nextDay' | 'lastDay' | 'nextWeek' | 'lastWeek' | 'sameElse' | string;
  21. type LongDateFormatKey = 'LTS' | 'LT' | 'L' | 'LL' | 'LLL' | 'LLLL' | 'lts' | 'lt' | 'l' | 'll' | 'lll' | 'llll';
  22. interface Locale {
  23. calendar(key?: CalendarKey, m?: Moment, now?: Moment): string;
  24. longDateFormat(key: LongDateFormatKey): string;
  25. invalidDate(): string;
  26. ordinal(n: number): string;
  27. preparse(inp: string): string;
  28. postformat(inp: string): string;
  29. relativeTime(n: number, withoutSuffix: boolean,
  30. key: RelativeTimeKey, isFuture: boolean): string;
  31. pastFuture(diff: number, absRelTime: string): string;
  32. set(config: Object): void;
  33. months(): string[];
  34. months(m: Moment, format?: string): string;
  35. monthsShort(): string[];
  36. monthsShort(m: Moment, format?: string): string;
  37. monthsParse(monthName: string, format: string, strict: boolean): number;
  38. monthsRegex(strict: boolean): RegExp;
  39. monthsShortRegex(strict: boolean): RegExp;
  40. week(m: Moment): number;
  41. firstDayOfYear(): number;
  42. firstDayOfWeek(): number;
  43. weekdays(): string[];
  44. weekdays(m: Moment, format?: string): string;
  45. weekdaysMin(): string[];
  46. weekdaysMin(m: Moment): string;
  47. weekdaysShort(): string[];
  48. weekdaysShort(m: Moment): string;
  49. weekdaysParse(weekdayName: string, format: string, strict: boolean): number;
  50. weekdaysRegex(strict: boolean): RegExp;
  51. weekdaysShortRegex(strict: boolean): RegExp;
  52. weekdaysMinRegex(strict: boolean): RegExp;
  53. isPM(input: string): boolean;
  54. meridiem(hour: number, minute: number, isLower: boolean): string;
  55. }
  56. interface StandaloneFormatSpec {
  57. format: string[];
  58. standalone: string[];
  59. isFormat?: RegExp;
  60. }
  61. interface WeekSpec {
  62. dow: number;
  63. doy?: number;
  64. }
  65. type CalendarSpecVal = string | ((m?: MomentInput, now?: Moment) => string);
  66. interface CalendarSpec {
  67. sameDay?: CalendarSpecVal;
  68. nextDay?: CalendarSpecVal;
  69. lastDay?: CalendarSpecVal;
  70. nextWeek?: CalendarSpecVal;
  71. lastWeek?: CalendarSpecVal;
  72. sameElse?: CalendarSpecVal;
  73. // any additional properties might be used with moment.calendarFormat
  74. [x: string]: CalendarSpecVal | void; // undefined
  75. }
  76. type RelativeTimeSpecVal = (
  77. string |
  78. ((n: number, withoutSuffix: boolean,
  79. key: RelativeTimeKey, isFuture: boolean) => string)
  80. );
  81. type RelativeTimeFuturePastVal = string | ((relTime: string) => string);
  82. interface RelativeTimeSpec {
  83. future?: RelativeTimeFuturePastVal;
  84. past?: RelativeTimeFuturePastVal;
  85. s?: RelativeTimeSpecVal;
  86. ss?: RelativeTimeSpecVal;
  87. m?: RelativeTimeSpecVal;
  88. mm?: RelativeTimeSpecVal;
  89. h?: RelativeTimeSpecVal;
  90. hh?: RelativeTimeSpecVal;
  91. d?: RelativeTimeSpecVal;
  92. dd?: RelativeTimeSpecVal;
  93. w?: RelativeTimeSpecVal
  94. M?: RelativeTimeSpecVal;
  95. MM?: RelativeTimeSpecVal;
  96. y?: RelativeTimeSpecVal;
  97. yy?: RelativeTimeSpecVal;
  98. }
  99. interface LongDateFormatSpec {
  100. LTS: string;
  101. LT: string;
  102. L: string;
  103. LL: string;
  104. LLL: string;
  105. LLLL: string;
  106. // lets forget for a sec that any upper/lower permutation will also work
  107. lts?: string;
  108. lt?: string;
  109. l?: string;
  110. ll?: string;
  111. lll?: string;
  112. llll?: string;
  113. }
  114. type MonthWeekdayFn = (momentToFormat: Moment, format?: string) => string;
  115. type WeekdaySimpleFn = (momentToFormat: Moment) => string;
  116. interface EraSpec {
  117. since: string | number;
  118. until: string | number;
  119. offset: number;
  120. name: string;
  121. narrow: string;
  122. abbr: string;
  123. }
  124. interface LocaleSpecification {
  125. months?: string[] | StandaloneFormatSpec | MonthWeekdayFn;
  126. monthsShort?: string[] | StandaloneFormatSpec | MonthWeekdayFn;
  127. weekdays?: string[] | StandaloneFormatSpec | MonthWeekdayFn;
  128. weekdaysShort?: string[] | StandaloneFormatSpec | WeekdaySimpleFn;
  129. weekdaysMin?: string[] | StandaloneFormatSpec | WeekdaySimpleFn;
  130. meridiemParse?: RegExp;
  131. meridiem?: (hour: number, minute:number, isLower: boolean) => string;
  132. isPM?: (input: string) => boolean;
  133. longDateFormat?: LongDateFormatSpec;
  134. calendar?: CalendarSpec;
  135. relativeTime?: RelativeTimeSpec;
  136. invalidDate?: string;
  137. ordinal?: (n: number) => string;
  138. ordinalParse?: RegExp;
  139. week?: WeekSpec;
  140. eras?: EraSpec[];
  141. // Allow anything: in general any property that is passed as locale spec is
  142. // put in the locale object so it can be used by locale functions
  143. [x: string]: any;
  144. }
  145. interface MomentObjectOutput {
  146. years: number;
  147. /* One digit */
  148. months: number;
  149. /* Day of the month */
  150. date: number;
  151. hours: number;
  152. minutes: number;
  153. seconds: number;
  154. milliseconds: number;
  155. }
  156. interface argThresholdOpts {
  157. ss?: number;
  158. s?: number;
  159. m?: number;
  160. h?: number;
  161. d?: number;
  162. w?: number | void;
  163. M?: number;
  164. }
  165. interface Duration {
  166. clone(): Duration;
  167. humanize(argWithSuffix?: boolean, argThresholds?: argThresholdOpts): string;
  168. humanize(argThresholds?: argThresholdOpts): string;
  169. abs(): Duration;
  170. as(units: unitOfTime.Base): number;
  171. get(units: unitOfTime.Base): number;
  172. milliseconds(): number;
  173. asMilliseconds(): number;
  174. seconds(): number;
  175. asSeconds(): number;
  176. minutes(): number;
  177. asMinutes(): number;
  178. hours(): number;
  179. asHours(): number;
  180. days(): number;
  181. asDays(): number;
  182. weeks(): number;
  183. asWeeks(): number;
  184. months(): number;
  185. asMonths(): number;
  186. years(): number;
  187. asYears(): number;
  188. add(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration;
  189. subtract(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration;
  190. locale(): string;
  191. locale(locale: LocaleSpecifier): Duration;
  192. localeData(): Locale;
  193. toISOString(): string;
  194. toJSON(): string;
  195. isValid(): boolean;
  196. /**
  197. * @deprecated since version 2.8.0
  198. */
  199. lang(locale: LocaleSpecifier): Moment;
  200. /**
  201. * @deprecated since version 2.8.0
  202. */
  203. lang(): Locale;
  204. /**
  205. * @deprecated
  206. */
  207. toIsoString(): string;
  208. }
  209. interface MomentRelativeTime {
  210. future: any;
  211. past: any;
  212. s: any;
  213. ss: any;
  214. m: any;
  215. mm: any;
  216. h: any;
  217. hh: any;
  218. d: any;
  219. dd: any;
  220. M: any;
  221. MM: any;
  222. y: any;
  223. yy: any;
  224. }
  225. interface MomentLongDateFormat {
  226. L: string;
  227. LL: string;
  228. LLL: string;
  229. LLLL: string;
  230. LT: string;
  231. LTS: string;
  232. l?: string;
  233. ll?: string;
  234. lll?: string;
  235. llll?: string;
  236. lt?: string;
  237. lts?: string;
  238. }
  239. interface MomentParsingFlags {
  240. empty: boolean;
  241. unusedTokens: string[];
  242. unusedInput: string[];
  243. overflow: number;
  244. charsLeftOver: number;
  245. nullInput: boolean;
  246. invalidMonth: string | void; // null
  247. invalidFormat: boolean;
  248. userInvalidated: boolean;
  249. iso: boolean;
  250. parsedDateParts: any[];
  251. meridiem: string | void; // null
  252. }
  253. interface MomentParsingFlagsOpt {
  254. empty?: boolean;
  255. unusedTokens?: string[];
  256. unusedInput?: string[];
  257. overflow?: number;
  258. charsLeftOver?: number;
  259. nullInput?: boolean;
  260. invalidMonth?: string;
  261. invalidFormat?: boolean;
  262. userInvalidated?: boolean;
  263. iso?: boolean;
  264. parsedDateParts?: any[];
  265. meridiem?: string;
  266. }
  267. interface MomentBuiltinFormat {
  268. __momentBuiltinFormatBrand: any;
  269. }
  270. type MomentFormatSpecification = string | MomentBuiltinFormat | (string | MomentBuiltinFormat)[];
  271. export namespace unitOfTime {
  272. type Base = (
  273. "year" | "years" | "y" |
  274. "month" | "months" | "M" |
  275. "week" | "weeks" | "w" |
  276. "day" | "days" | "d" |
  277. "hour" | "hours" | "h" |
  278. "minute" | "minutes" | "m" |
  279. "second" | "seconds" | "s" |
  280. "millisecond" | "milliseconds" | "ms"
  281. );
  282. type _quarter = "quarter" | "quarters" | "Q";
  283. type _isoWeek = "isoWeek" | "isoWeeks" | "W";
  284. type _date = "date" | "dates" | "D";
  285. type DurationConstructor = Base | _quarter | _isoWeek;
  286. export type DurationAs = Base;
  287. export type StartOf = Base | _quarter | _isoWeek | _date | void; // null
  288. export type Diff = Base | _quarter;
  289. export type MomentConstructor = Base | _date;
  290. export type All = Base | _quarter | _isoWeek | _date |
  291. "weekYear" | "weekYears" | "gg" |
  292. "isoWeekYear" | "isoWeekYears" | "GG" |
  293. "dayOfYear" | "dayOfYears" | "DDD" |
  294. "weekday" | "weekdays" | "e" |
  295. "isoWeekday" | "isoWeekdays" | "E";
  296. }
  297. type numberlike = number | string;
  298. interface MomentInputObject {
  299. years?: numberlike;
  300. year?: numberlike;
  301. y?: numberlike;
  302. months?: numberlike;
  303. month?: numberlike;
  304. M?: numberlike;
  305. days?: numberlike;
  306. day?: numberlike;
  307. d?: numberlike;
  308. dates?: numberlike;
  309. date?: numberlike;
  310. D?: numberlike;
  311. hours?: numberlike;
  312. hour?: numberlike;
  313. h?: numberlike;
  314. minutes?: numberlike;
  315. minute?: numberlike;
  316. m?: numberlike;
  317. seconds?: numberlike;
  318. second?: numberlike;
  319. s?: numberlike;
  320. milliseconds?: numberlike;
  321. millisecond?: numberlike;
  322. ms?: numberlike;
  323. }
  324. interface DurationInputObject extends MomentInputObject {
  325. quarters?: numberlike;
  326. quarter?: numberlike;
  327. Q?: numberlike;
  328. weeks?: numberlike;
  329. week?: numberlike;
  330. w?: numberlike;
  331. }
  332. interface MomentSetObject extends MomentInputObject {
  333. weekYears?: numberlike;
  334. weekYear?: numberlike;
  335. gg?: numberlike;
  336. isoWeekYears?: numberlike;
  337. isoWeekYear?: numberlike;
  338. GG?: numberlike;
  339. quarters?: numberlike;
  340. quarter?: numberlike;
  341. Q?: numberlike;
  342. weeks?: numberlike;
  343. week?: numberlike;
  344. w?: numberlike;
  345. isoWeeks?: numberlike;
  346. isoWeek?: numberlike;
  347. W?: numberlike;
  348. dayOfYears?: numberlike;
  349. dayOfYear?: numberlike;
  350. DDD?: numberlike;
  351. weekdays?: numberlike;
  352. weekday?: numberlike;
  353. e?: numberlike;
  354. isoWeekdays?: numberlike;
  355. isoWeekday?: numberlike;
  356. E?: numberlike;
  357. }
  358. interface FromTo {
  359. from: MomentInput;
  360. to: MomentInput;
  361. }
  362. type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  363. type DurationInputArg1 = Duration | number | string | FromTo | DurationInputObject | void; // null | undefined
  364. type DurationInputArg2 = unitOfTime.DurationConstructor;
  365. type LocaleSpecifier = string | Moment | Duration | string[] | boolean;
  366. interface MomentCreationData {
  367. input: MomentInput;
  368. format?: MomentFormatSpecification;
  369. locale: Locale;
  370. isUTC: boolean;
  371. strict?: boolean;
  372. }
  373. interface Moment extends Object {
  374. format(format?: string): string;
  375. startOf(unitOfTime: unitOfTime.StartOf): Moment;
  376. endOf(unitOfTime: unitOfTime.StartOf): Moment;
  377. add(amount?: DurationInputArg1, unit?: DurationInputArg2): Moment;
  378. /**
  379. * @deprecated reverse syntax
  380. */
  381. add(unit: unitOfTime.DurationConstructor, amount: number|string): Moment;
  382. subtract(amount?: DurationInputArg1, unit?: DurationInputArg2): Moment;
  383. /**
  384. * @deprecated reverse syntax
  385. */
  386. subtract(unit: unitOfTime.DurationConstructor, amount: number|string): Moment;
  387. calendar(): string;
  388. calendar(formats: CalendarSpec): string;
  389. calendar(time: MomentInput, formats?: CalendarSpec): string;
  390. clone(): Moment;
  391. /**
  392. * @return Unix timestamp in milliseconds
  393. */
  394. valueOf(): number;
  395. // current date/time in local mode
  396. local(keepLocalTime?: boolean): Moment;
  397. isLocal(): boolean;
  398. // current date/time in UTC mode
  399. utc(keepLocalTime?: boolean): Moment;
  400. isUTC(): boolean;
  401. /**
  402. * @deprecated use isUTC
  403. */
  404. isUtc(): boolean;
  405. parseZone(): Moment;
  406. isValid(): boolean;
  407. invalidAt(): number;
  408. hasAlignedHourOffset(other?: MomentInput): boolean;
  409. creationData(): MomentCreationData;
  410. parsingFlags(): MomentParsingFlags;
  411. year(y: number): Moment;
  412. year(): number;
  413. /**
  414. * @deprecated use year(y)
  415. */
  416. years(y: number): Moment;
  417. /**
  418. * @deprecated use year()
  419. */
  420. years(): number;
  421. quarter(): number;
  422. quarter(q: number): Moment;
  423. quarters(): number;
  424. quarters(q: number): Moment;
  425. month(M: number|string): Moment;
  426. month(): number;
  427. /**
  428. * @deprecated use month(M)
  429. */
  430. months(M: number|string): Moment;
  431. /**
  432. * @deprecated use month()
  433. */
  434. months(): number;
  435. day(d: number|string): Moment;
  436. day(): number;
  437. days(d: number|string): Moment;
  438. days(): number;
  439. date(d: number): Moment;
  440. date(): number;
  441. /**
  442. * @deprecated use date(d)
  443. */
  444. dates(d: number): Moment;
  445. /**
  446. * @deprecated use date()
  447. */
  448. dates(): number;
  449. hour(h: number): Moment;
  450. hour(): number;
  451. hours(h: number): Moment;
  452. hours(): number;
  453. minute(m: number): Moment;
  454. minute(): number;
  455. minutes(m: number): Moment;
  456. minutes(): number;
  457. second(s: number): Moment;
  458. second(): number;
  459. seconds(s: number): Moment;
  460. seconds(): number;
  461. millisecond(ms: number): Moment;
  462. millisecond(): number;
  463. milliseconds(ms: number): Moment;
  464. milliseconds(): number;
  465. weekday(): number;
  466. weekday(d: number): Moment;
  467. isoWeekday(): number;
  468. isoWeekday(d: number|string): Moment;
  469. weekYear(): number;
  470. weekYear(d: number): Moment;
  471. isoWeekYear(): number;
  472. isoWeekYear(d: number): Moment;
  473. week(): number;
  474. week(d: number): Moment;
  475. weeks(): number;
  476. weeks(d: number): Moment;
  477. isoWeek(): number;
  478. isoWeek(d: number): Moment;
  479. isoWeeks(): number;
  480. isoWeeks(d: number): Moment;
  481. weeksInYear(): number;
  482. weeksInWeekYear(): number;
  483. isoWeeksInYear(): number;
  484. isoWeeksInISOWeekYear(): number;
  485. dayOfYear(): number;
  486. dayOfYear(d: number): Moment;
  487. from(inp: MomentInput, suffix?: boolean): string;
  488. to(inp: MomentInput, suffix?: boolean): string;
  489. fromNow(withoutSuffix?: boolean): string;
  490. toNow(withoutPrefix?: boolean): string;
  491. diff(b: MomentInput, unitOfTime?: unitOfTime.Diff, precise?: boolean): number;
  492. toArray(): number[];
  493. toDate(): Date;
  494. toISOString(keepOffset?: boolean): string;
  495. inspect(): string;
  496. toJSON(): string;
  497. unix(): number;
  498. isLeapYear(): boolean;
  499. /**
  500. * @deprecated in favor of utcOffset
  501. */
  502. zone(): number;
  503. zone(b: number|string): Moment;
  504. utcOffset(): number;
  505. utcOffset(b: number|string, keepLocalTime?: boolean): Moment;
  506. isUtcOffset(): boolean;
  507. daysInMonth(): number;
  508. isDST(): boolean;
  509. zoneAbbr(): string;
  510. zoneName(): string;
  511. isBefore(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean;
  512. isAfter(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean;
  513. isSame(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean;
  514. isSameOrAfter(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean;
  515. isSameOrBefore(inp?: MomentInput, granularity?: unitOfTime.StartOf): boolean;
  516. isBetween(a: MomentInput, b: MomentInput, granularity?: unitOfTime.StartOf, inclusivity?: "()" | "[)" | "(]" | "[]"): boolean;
  517. /**
  518. * @deprecated as of 2.8.0, use locale
  519. */
  520. lang(language: LocaleSpecifier): Moment;
  521. /**
  522. * @deprecated as of 2.8.0, use locale
  523. */
  524. lang(): Locale;
  525. locale(): string;
  526. locale(locale: LocaleSpecifier): Moment;
  527. localeData(): Locale;
  528. /**
  529. * @deprecated no reliable implementation
  530. */
  531. isDSTShifted(): boolean;
  532. // NOTE(constructor): Same as moment constructor
  533. /**
  534. * @deprecated as of 2.7.0, use moment.min/max
  535. */
  536. max(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment;
  537. /**
  538. * @deprecated as of 2.7.0, use moment.min/max
  539. */
  540. max(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment;
  541. // NOTE(constructor): Same as moment constructor
  542. /**
  543. * @deprecated as of 2.7.0, use moment.min/max
  544. */
  545. min(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment;
  546. /**
  547. * @deprecated as of 2.7.0, use moment.min/max
  548. */
  549. min(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment;
  550. get(unit: unitOfTime.All): number;
  551. set(unit: unitOfTime.All, value: number): Moment;
  552. set(objectLiteral: MomentSetObject): Moment;
  553. toObject(): MomentObjectOutput;
  554. }
  555. export var version: string;
  556. export var fn: Moment;
  557. // NOTE(constructor): Same as moment constructor
  558. export function utc(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment;
  559. export function utc(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment;
  560. export function unix(timestamp: number): Moment;
  561. export function invalid(flags?: MomentParsingFlagsOpt): Moment;
  562. export function isMoment(m: any): m is Moment;
  563. export function isDate(m: any): m is Date;
  564. export function isDuration(d: any): d is Duration;
  565. /**
  566. * @deprecated in 2.8.0
  567. */
  568. export function lang(language?: string): string;
  569. /**
  570. * @deprecated in 2.8.0
  571. */
  572. export function lang(language?: string, definition?: Locale): string;
  573. export function locale(language?: string): string;
  574. export function locale(language?: string[]): string;
  575. export function locale(language?: string, definition?: LocaleSpecification | void): string; // null | undefined
  576. export function localeData(key?: string | string[]): Locale;
  577. export function duration(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration;
  578. // NOTE(constructor): Same as moment constructor
  579. export function parseZone(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment;
  580. export function parseZone(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment;
  581. export function months(): string[];
  582. export function months(index: number): string;
  583. export function months(format: string): string[];
  584. export function months(format: string, index: number): string;
  585. export function monthsShort(): string[];
  586. export function monthsShort(index: number): string;
  587. export function monthsShort(format: string): string[];
  588. export function monthsShort(format: string, index: number): string;
  589. export function weekdays(): string[];
  590. export function weekdays(index: number): string;
  591. export function weekdays(format: string): string[];
  592. export function weekdays(format: string, index: number): string;
  593. export function weekdays(localeSorted: boolean): string[];
  594. export function weekdays(localeSorted: boolean, index: number): string;
  595. export function weekdays(localeSorted: boolean, format: string): string[];
  596. export function weekdays(localeSorted: boolean, format: string, index: number): string;
  597. export function weekdaysShort(): string[];
  598. export function weekdaysShort(index: number): string;
  599. export function weekdaysShort(format: string): string[];
  600. export function weekdaysShort(format: string, index: number): string;
  601. export function weekdaysShort(localeSorted: boolean): string[];
  602. export function weekdaysShort(localeSorted: boolean, index: number): string;
  603. export function weekdaysShort(localeSorted: boolean, format: string): string[];
  604. export function weekdaysShort(localeSorted: boolean, format: string, index: number): string;
  605. export function weekdaysMin(): string[];
  606. export function weekdaysMin(index: number): string;
  607. export function weekdaysMin(format: string): string[];
  608. export function weekdaysMin(format: string, index: number): string;
  609. export function weekdaysMin(localeSorted: boolean): string[];
  610. export function weekdaysMin(localeSorted: boolean, index: number): string;
  611. export function weekdaysMin(localeSorted: boolean, format: string): string[];
  612. export function weekdaysMin(localeSorted: boolean, format: string, index: number): string;
  613. export function min(moments: Moment[]): Moment;
  614. export function min(...moments: Moment[]): Moment;
  615. export function max(moments: Moment[]): Moment;
  616. export function max(...moments: Moment[]): Moment;
  617. /**
  618. * Returns unix time in milliseconds. Overwrite for profit.
  619. */
  620. export function now(): number;
  621. export function defineLocale(language: string, localeSpec: LocaleSpecification | void): Locale; // null
  622. export function updateLocale(language: string, localeSpec: LocaleSpecification | void): Locale; // null
  623. export function locales(): string[];
  624. export function normalizeUnits(unit: unitOfTime.All): string;
  625. export function relativeTimeThreshold(threshold: string): number | boolean;
  626. export function relativeTimeThreshold(threshold: string, limit: number): boolean;
  627. export function relativeTimeRounding(fn: (num: number) => number): boolean;
  628. export function relativeTimeRounding(): (num: number) => number;
  629. export function calendarFormat(m: Moment, now: Moment): string;
  630. export function parseTwoDigitYear(input: string): number;
  631. /**
  632. * Constant used to enable explicit ISO_8601 format parsing.
  633. */
  634. export var ISO_8601: MomentBuiltinFormat;
  635. export var RFC_2822: MomentBuiltinFormat;
  636. export var defaultFormat: string;
  637. export var defaultFormatUtc: string;
  638. export var HTML5_FMT: {
  639. DATETIME_LOCAL: string,
  640. DATETIME_LOCAL_SECONDS: string,
  641. DATETIME_LOCAL_MS: string,
  642. DATE: string,
  643. TIME: string,
  644. TIME_SECONDS: string,
  645. TIME_MS: string,
  646. WEEK: string,
  647. MONTH: string
  648. };
  649. }
  650. export = moment;