moment.d.ts 21 KB

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