basant307/AI_Governance_Project
048
1/// <reference path="./locale/index.d.ts" />2 3export = dayjs;4 5declare function dayjs (date?: dayjs.ConfigType): dayjs.Dayjs6 7declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, strict?: boolean): dayjs.Dayjs8 9declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean): dayjs.Dayjs10 11declare namespace dayjs {12 interface ConfigTypeMap {13 default: string | number | Date | Dayjs | null | undefined14 }15 16 export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap]17 18 export interface FormatObject { locale?: string, format?: string, utc?: boolean }19 20 export type OptionType = FormatObject | string | string[]21 22 export type UnitTypeShort = 'd' | 'D' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'23 24 export type UnitTypeLong = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date'25 26 export type UnitTypeLongPlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' | 'dates'27 28 export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort;29 30 export type OpUnitType = UnitType | "week" | "weeks" | 'w';31 export type QUnitType = UnitType | "quarter" | "quarters" | 'Q';32 export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'>;33 class Dayjs {34 constructor (config?: ConfigType)35 /**36 * All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one.37 * ```38 * dayjs().clone()// => Dayjs39 * dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it40 * ```41 * Docs: https://day.js.org/docs/en/parse/dayjs-clone42 */43 clone(): Dayjs44 /**45 * This returns a `boolean` indicating whether the Day.js object contains a valid date or not.46 * ```47 * dayjs().isValid()// => boolean48 * ```49 * Docs: https://day.js.org/docs/en/parse/is-valid50 */51 isValid(): boolean52 /**53 * Get the year.54 * ```55 * dayjs().year()// => 202056 * ```57 * Docs: https://day.js.org/docs/en/get-set/year58 */59 year(): number60 /**61 * Set the year.62 * ```63 * dayjs().year(2000)// => Dayjs64 * ```65 * Docs: https://day.js.org/docs/en/get-set/year66 */67 year(value: number): Dayjs68 /**69 * Get the month.70 *71 * Months are zero indexed, so January is month 0.72 * ```73 * dayjs().month()// => 0-1174 * ```75 * Docs: https://day.js.org/docs/en/get-set/month76 */77 month(): number78 /**79 * Set the month.80 *81 * Months are zero indexed, so January is month 0.82 *83 * Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the next year.84 * ```85 * dayjs().month(0)// => Dayjs86 * ```87 * Docs: https://day.js.org/docs/en/get-set/month88 */89 month(value: number): Dayjs90 /**91 * Get the date of the month.92 * ```93 * dayjs().date()// => 1-3194 * ```95 * Docs: https://day.js.org/docs/en/get-set/date96 */97 date(): number98 /**99 * Set the date of the month.100 *101 * Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the next months.102 * ```103 * dayjs().date(1)// => Dayjs104 * ```105 * Docs: https://day.js.org/docs/en/get-set/date106 */107 date(value: number): Dayjs108 /**109 * Get the day of the week.110 *111 * Returns numbers from 0 (Sunday) to 6 (Saturday).112 * ```113 * dayjs().day()// 0-6114 * ```115 * Docs: https://day.js.org/docs/en/get-set/day116 */117 day(): 0 | 1 | 2 | 3 | 4 | 5 | 6118 /**119 * Set the day of the week.120 *121 * Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to next weeks.122 * ```123 * dayjs().day(0)// => Dayjs124 * ```125 * Docs: https://day.js.org/docs/en/get-set/day126 */127 day(value: number): Dayjs128 /**129 * Get the hour.130 * ```131 * dayjs().hour()// => 0-23132 * ```133 * Docs: https://day.js.org/docs/en/get-set/hour134 */135 hour(): number136 /**137 * Set the hour.138 *139 * Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the next day.140 * ```141 * dayjs().hour(12)// => Dayjs142 * ```143 * Docs: https://day.js.org/docs/en/get-set/hour144 */145 hour(value: number): Dayjs146 /**147 * Get the minutes.148 * ```149 * dayjs().minute()// => 0-59150 * ```151 * Docs: https://day.js.org/docs/en/get-set/minute152 */153 minute(): number154 /**155 * Set the minutes.156 *157 * Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next hour.158 * ```159 * dayjs().minute(59)// => Dayjs160 * ```161 * Docs: https://day.js.org/docs/en/get-set/minute162 */163 minute(value: number): Dayjs164 /**165 * Get the seconds.166 * ```167 * dayjs().second()// => 0-59168 * ```169 * Docs: https://day.js.org/docs/en/get-set/second170 */171 second(): number172 /**173 * Set the seconds.174 *175 * Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next minutes.176 * ```177 * dayjs().second(1)// Dayjs178 * ```179 */180 second(value: number): Dayjs181 /**182 * Get the milliseconds.183 * ```184 * dayjs().millisecond()// => 0-999185 * ```186 * Docs: https://day.js.org/docs/en/get-set/millisecond187 */188 millisecond(): number189 /**190 * Set the milliseconds.191 *192 * Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the next seconds.193 * ```194 * dayjs().millisecond(1)// => Dayjs195 * ```196 * Docs: https://day.js.org/docs/en/get-set/millisecond197 */198 millisecond(value: number): Dayjs199 /**200 * Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes.201 *202 * In general:203 * ```204 * dayjs().set(unit, value) === dayjs()[unit](value)205 * ```206 * Units are case insensitive, and support plural and short forms.207 * ```208 * dayjs().set('date', 1)209 * dayjs().set('month', 3) // April210 * dayjs().set('second', 30)211 * ```212 * Docs: https://day.js.org/docs/en/get-set/set213 */214 set(unit: UnitType, value: number): Dayjs215 /**216 * String getter, returns the corresponding information getting from Day.js object.217 *218 * In general:219 * ```220 * dayjs().get(unit) === dayjs()[unit]()221 * ```222 * Units are case insensitive, and support plural and short forms.223 * ```224 * dayjs().get('year')225 * dayjs().get('month') // start 0226 * dayjs().get('date')227 * ```228 * Docs: https://day.js.org/docs/en/get-set/get229 */230 get(unit: UnitType): number231 /**232 * Returns a cloned Day.js object with a specified amount of time added.233 * ```234 * dayjs().add(7, 'day')// => Dayjs235 * ```236 * Units are case insensitive, and support plural and short forms.237 *238 * Docs: https://day.js.org/docs/en/manipulate/add239 */240 add(value: number, unit?: ManipulateType): Dayjs241 /**242 * Returns a cloned Day.js object with a specified amount of time subtracted.243 * ```244 * dayjs().subtract(7, 'year')// => Dayjs245 * ```246 * Units are case insensitive, and support plural and short forms.247 *248 * Docs: https://day.js.org/docs/en/manipulate/subtract249 */250 subtract(value: number, unit?: ManipulateType): Dayjs251 /**252 * Returns a cloned Day.js object and set it to the start of a unit of time.253 * ```254 * dayjs().startOf('year')// => Dayjs255 * ```256 * Units are case insensitive, and support plural and short forms.257 *258 * Docs: https://day.js.org/docs/en/manipulate/start-of259 */260 startOf(unit: OpUnitType): Dayjs261 /**262 * Returns a cloned Day.js object and set it to the end of a unit of time.263 * ```264 * dayjs().endOf('month')// => Dayjs265 * ```266 * Units are case insensitive, and support plural and short forms.267 *268 * Docs: https://day.js.org/docs/en/manipulate/end-of269 */270 endOf(unit: OpUnitType): Dayjs271 /**272 * Get the formatted date according to the string of tokens passed in.273 *274 * To escape characters, wrap them in square brackets (e.g. [MM]).275 * ```276 * dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00'277 * dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z'278 * dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'279 * ```280 * Docs: https://day.js.org/docs/en/display/format281 */282 format(template?: string): string283 /**284 * This indicates the difference between two date-time in the specified unit.285 *286 * To get the difference in milliseconds, use `dayjs#diff`287 * ```288 * const date1 = dayjs('2019-01-25')289 * const date2 = dayjs('2018-06-05')290 * date1.diff(date2) // 20214000000 default milliseconds291 * date1.diff() // milliseconds to current time292 * ```293 *294 * To get the difference in another unit of measurement, pass that measurement as the second argument.295 * ```296 * const date1 = dayjs('2019-01-25')297 * date1.diff('2018-06-05', 'month') // 7298 * ```299 * Units are case insensitive, and support plural and short forms.300 *301 * Docs: https://day.js.org/docs/en/display/difference302 */303 diff(date?: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number304 /**305 * This returns the number of **milliseconds** since the Unix Epoch of the Day.js object.306 * ```307 * dayjs('2019-01-25').valueOf() // 1548381600000308 * +dayjs(1548381600000) // 1548381600000309 * ```310 * To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`.311 *312 * Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds313 */314 valueOf(): number315 /**316 * This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object.317 * ```318 * dayjs('2019-01-25').unix() // 1548381600319 * ```320 * This value is floored to the nearest second, and does not include a milliseconds component.321 *322 * Docs: https://day.js.org/docs/en/display/unix-timestamp323 */324 unix(): number325 /**326 * Get the number of days in the current month.327 * ```328 * dayjs('2019-01-25').daysInMonth() // 31329 * ```330 * Docs: https://day.js.org/docs/en/display/days-in-month331 */332 daysInMonth(): number333 /**334 * To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`.335 * ```336 * dayjs('2019-01-25').toDate()// => Date337 * ```338 */339 toDate(): Date340 /**341 * To serialize as an ISO 8601 string.342 * ```343 * dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z'344 * ```345 * Docs: https://day.js.org/docs/en/display/as-json346 */347 toJSON(): string348 /**349 * To format as an ISO 8601 string.350 * ```351 * dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z'352 * ```353 * Docs: https://day.js.org/docs/en/display/as-iso-string354 */355 toISOString(): string356 /**357 * Returns a string representation of the date.358 * ```359 * dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT'360 * ```361 * Docs: https://day.js.org/docs/en/display/as-string362 */363 toString(): string364 /**365 * Get the UTC offset in minutes.366 * ```367 * dayjs().utcOffset()368 * ```369 * Docs: https://day.js.org/docs/en/manipulate/utc-offset370 */371 utcOffset(): number372 /**373 * This indicates whether the Day.js object is before the other supplied date-time.374 * ```375 * dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds376 * ```377 * If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.378 * ```379 * dayjs().isBefore('2011-01-01', 'year')// => boolean380 * ```381 * Units are case insensitive, and support plural and short forms.382 *383 * Docs: https://day.js.org/docs/en/query/is-before384 */385 isBefore(date?: ConfigType, unit?: OpUnitType): boolean386 /**387 * This indicates whether the Day.js object is the same as the other supplied date-time.388 * ```389 * dayjs().isSame(dayjs('2011-01-01')) // default milliseconds390 * ```391 * If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.392 * ```393 * dayjs().isSame('2011-01-01', 'year')// => boolean394 * ```395 * Docs: https://day.js.org/docs/en/query/is-same396 */397 isSame(date?: ConfigType, unit?: OpUnitType): boolean398 /**399 * This indicates whether the Day.js object is after the other supplied date-time.400 * ```401 * dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds402 * ```403 * If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.404 * ```405 * dayjs().isAfter('2011-01-01', 'year')// => boolean406 * ```407 * Units are case insensitive, and support plural and short forms.408 *409 * Docs: https://day.js.org/docs/en/query/is-after410 */411 isAfter(date?: ConfigType, unit?: OpUnitType): boolean412 413 locale(): string414 415 locale(preset: string | ILocale, object?: Partial<ILocale>): Dayjs416 }417 418 export type PluginFunc<T = unknown> = (option: T, c: typeof Dayjs, d: typeof dayjs) => void419 420 export function extend<T = unknown>(plugin: PluginFunc<T>, option?: T): Dayjs421 422 export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string423 424 export function isDayjs(d: any): d is Dayjs425 426 export function unix(t: number): Dayjs427 428 const Ls : { [key: string] : ILocale }429}430 