moment.d.ts 20 KB

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