moment.d.ts 21 KB

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