| 2 | |
| 3 | /** a date/timezone object */ |
| 4 | export interface Spacetime { |
| 5 | /** |
| 6 | * @deprecated use toNativeDate. This is an implementation detail that was not intended for external use |
| 7 | * @returns the date as a native date object |
| 8 | */ |
| 9 | d: Date |
| 10 | |
| 11 | /** @returns epoch in milliseconds */ |
| 12 | epoch: number |
| 13 | |
| 14 | /** @returns whether warnings are enabled */ |
| 15 | silent: boolean |
| 16 | |
| 17 | /** @returns the timezone tz database name, eg, 'america/denver' */ |
| 18 | tz: string |
| 19 | |
| 20 | /** @returns the tz database nameset */ |
| 21 | timezones: TimezoneSet |
| 22 | |
| 23 | /** move to a new timezone, but at this same moment. Accepts an IANA code or abbreviation */ |
| 24 | goto: (target: string | null) => Spacetime |
| 25 | |
| 26 | /** @returns a copy of this object, with no references to the original */ |
| 27 | clone: () => Spacetime |
| 28 | |
| 29 | /** |
| 30 | * @deprecated use toNativeDate() |
| 31 | * @returns the native Date object at the same epoch |
| 32 | */ |
| 33 | toLocalDate(): Date |
| 34 | |
| 35 | /** @returns the native Date object at the same epoch */ |
| 36 | toNativeDate(): Date |
| 37 | |
| 38 | /** @returns a bunch of meta-data about your current timezone */ |
| 39 | timezone(): TimezoneMeta |
| 40 | /** swap the timezone, but keep the same date-time (if possible) */ |
| 41 | timezone(tz: String): Spacetime |
| 42 | |
| 43 | /** output nicely-formatted strings */ |
| 44 | format: (format: Format) => string |
| 45 | |
| 46 | /** output formatted string using unix formatting code (yyyy.MM.dd h:mm a) */ |
| 47 | unixFmt: (format: string) => string |
| 48 | |
| 49 | /** move to the first millisecond of the day, week, month, year, etc. */ |
| 50 | startOf: (unit: TimeUnit) => Spacetime |
| 51 | |
| 52 | /** move to the last millisecond of the day, week, month, year, etc. */ |
| 53 | endOf: (unit: TimeUnit) => Spacetime |
| 54 | |
| 55 | /** increment the time by a number and unit - like an hour, minute, day, or year */ |
| 56 | add: (value: number, unit: TimeUnit) => Spacetime |
| 57 | |
| 58 | /** decrease the time by a number and unit - like an hour, minute, day, or year */ |
| 59 | subtract: (value: number, unit: TimeUnit) => Spacetime |
| 60 | |
| 61 | /** go to the beginning of the next unit */ |
no outgoing calls
no test coverage detected