@types/date-and-time
Advanced tools
Comparing version 0.6.0 to 0.13.0
@@ -1,50 +0,90 @@ | ||
// Type definitions for date-and-time 0.6 | ||
// Type definitions for date-and-time 0.13 | ||
// Project: https://github.com/knowledgecode/date-and-time | ||
// Definitions by: Daniel Plisetsky <https://github.com/danplisetsky> | ||
// Justin Grant <https://github.com/justingrant> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
export interface PreparseResult { | ||
/** Year */ | ||
Y: number; | ||
/** Month */ | ||
M: number; | ||
/** Day */ | ||
D: number; | ||
/** 24-hour */ | ||
H: number; | ||
/** Meridiem */ | ||
A: number; | ||
/** 12-hour */ | ||
h: number; | ||
/** Minute */ | ||
m: number; | ||
/** Second */ | ||
s: number; | ||
/** Millisecond */ | ||
S: number; | ||
/** Timezone offset */ | ||
Z: number; | ||
/** Pointer offset */ | ||
_index: number; | ||
/** Length of the date string */ | ||
_length: number; | ||
/** Token matching count */ | ||
_match: number; | ||
} | ||
/** @deprecated */ | ||
export type getDelta = () => number; | ||
export interface Subtract { | ||
toMilliseconds: getDelta; | ||
toSeconds: getDelta; | ||
toMinutes: getDelta; | ||
toHours: getDelta; | ||
toDays: getDelta; | ||
export interface SubtractResult { | ||
toMilliseconds: () => number; | ||
toSeconds: () => number; | ||
toMinutes: () => number; | ||
toHours: () => number; | ||
toDays: () => number; | ||
} | ||
/** @deprecated Use `SubtractResult` instead */ | ||
export type Subtract = SubtractResult; | ||
/** | ||
* Compiling a format string | ||
* @param formatString - Format string | ||
* @returns The compiled object | ||
*/ | ||
export function compile(formatString: string): string[]; | ||
/** | ||
* Pre-parsing a date string | ||
* @param dateString - Date string | ||
* @param formatter - Format string or a compiled object | ||
* @returns The date structure | ||
*/ | ||
export function preparse(dateString: string, formatString: string | string[]): PreparseResult; | ||
/** | ||
* Formatting a date | ||
* @param dateObj - Date object | ||
* @param formatString - Format string | ||
* @param [utc] - Output as UTC | ||
* @param formatter - Format string or a compiled object | ||
* @param utc - Output as UTC? | ||
* @returns The formatted string | ||
* | ||
*/ | ||
export function format( | ||
dateObj: Date, | ||
formatString: string, | ||
utc?: boolean | ||
): string; | ||
export function format(dateObj: Date, formatString: string | string[], utc?: boolean): string; | ||
/** | ||
* Parsing a date string | ||
* @param dateString - date string | ||
* @param formatString - format string | ||
* @param [utc] - input as UTC | ||
* @returns the constructed date or NaN | ||
* @param dateString - Date string | ||
* @param formatter - Format string or a compiled object | ||
* @param [utc] - Input as UTC | ||
* @returns The constructed date | ||
*/ | ||
export function parse( | ||
dateString: string, | ||
formatString: string, | ||
utc?: boolean | ||
): Date | number; | ||
export function parse(dateString: string, formatter: string | string[], utc?: boolean): Date; | ||
/** | ||
* Validation | ||
* @param dateString - Date string | ||
* @param formatString - Format string | ||
* @param dateValue - Date string or preparsed date structure | ||
* @param formatter - Format string or a compiled object | ||
* @returns Whether the date string is a valid date | ||
*/ | ||
export function isValid(dateString: string, formatString: string): boolean; | ||
export function isValid(dateValue: string | PreparseResult, formatter?: string | string[]): boolean; | ||
@@ -54,3 +94,3 @@ /** | ||
* @param dateObj - Date object | ||
* @param years - Adding year | ||
* @param years - Number of years to add | ||
* @returns The date after adding the value | ||
@@ -63,3 +103,3 @@ */ | ||
* @param dateObj - Date object | ||
* @param months - Adding month | ||
* @param months - Number of months to add | ||
* @returns The date after adding the value | ||
@@ -72,3 +112,3 @@ */ | ||
* @param dateObj - Date object | ||
* @param days - Adding day | ||
* @param days - Number of days to add | ||
* @returns The date after adding the value | ||
@@ -81,3 +121,3 @@ */ | ||
* @param dateObj - Date object | ||
* @param hours - Adding hour | ||
* @param hours - Number of hours to add | ||
* @returns The date after adding the value | ||
@@ -90,3 +130,3 @@ */ | ||
* @param dateObj - Date object | ||
* @param minutes - Adding minute | ||
* @param minutes - Number of minutes to add | ||
* @returns The date after adding the value | ||
@@ -98,4 +138,4 @@ */ | ||
* Adding seconds | ||
* @param dateObj - date object | ||
* @param seconds - adding second | ||
* @param dateObj - Date object | ||
* @param seconds - Number of seconds to add | ||
* @returns The date after adding the value | ||
@@ -108,3 +148,3 @@ */ | ||
* @param dateObj - Date object | ||
* @param milliseconds - Adding millisecond | ||
* @param milliseconds - Number of milliseconds to add | ||
* @returns The date after adding the value | ||
@@ -118,17 +158,17 @@ */ | ||
* @param date2 - Date object | ||
* @returns The result object after subtracting the date | ||
* @returns The result object subtracting date2 from date1 | ||
*/ | ||
export function subtract(date1: Date, date2: Date): Subtract; | ||
export function subtract(date1: Date, date2: Date): SubtractResult; | ||
/** | ||
* Leap year | ||
* @param dateObj - Date object | ||
* @param y - Year as a number | ||
* @returns Whether the year is a leap year | ||
*/ | ||
export function isLeapYear(dateObj: Date): boolean; | ||
export function isLeapYear(y: number): boolean; | ||
/** | ||
* Comparison of dates | ||
* @param date1 - Target for comparison | ||
* @param date2 - Target for comparison | ||
* @param date1 - Date object | ||
* @param date2 - Date object | ||
* @returns Whether the dates are the same day (times are ignored) | ||
@@ -139,21 +179,20 @@ */ | ||
/** | ||
* Setting a locale | ||
* Change locale or setting a new locale definition | ||
* @param [code] - Language code | ||
* @param [locale] - locale definition | ||
* @returns Current language code | ||
*/ | ||
export function locale(code?: string): string; | ||
export function locale(code?: string, locale?: Record<string, unknown>): string; | ||
/** | ||
* Getting a definition of locale | ||
* @param [code] - Language code | ||
* @returns Definition of locale | ||
* Locale extension | ||
* @param extension - Locale extension | ||
*/ | ||
export function getLocales(code?: string): any; | ||
export function extend(extension: Record<string, unknown>): void; | ||
/** | ||
* Adding a new definition of locale | ||
* @param code - Language code | ||
* @param options - Definition of locale | ||
* @returns | ||
* Plugin import or definition | ||
* @param name - Plugin name | ||
* @param extension - Locale extension | ||
*/ | ||
export function setLocales(code: string, options: any): void; | ||
export function plugin(name: string, extension?: Record<string, unknown>): void; |
{ | ||
"name": "@types/date-and-time", | ||
"version": "0.6.0", | ||
"version": "0.13.0", | ||
"description": "TypeScript definitions for date-and-time", | ||
@@ -11,6 +11,11 @@ "license": "MIT", | ||
"githubUsername": "danplisetsky" | ||
}, | ||
{ | ||
"name": "Justin Grant", | ||
"url": "https://github.com/justingrant", | ||
"githubUsername": "justingrant" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -23,4 +28,4 @@ "type": "git", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "f17f1b07b5bc809c80e90360b3e0b4ade5d720e89ca2dd6e530088db7400ef06", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "679ead15ebe8b4a7696731553c09aac9476b0a978d33f1144e10953f59db0c89", | ||
"typeScriptVersion": "3.0" | ||
} |
@@ -5,9 +5,9 @@ # Installation | ||
# Summary | ||
This package contains type definitions for date-and-time ( https://github.com/knowledgecode/date-and-time ). | ||
This package contains type definitions for date-and-time (https://github.com/knowledgecode/date-and-time). | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/date-and-time | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/date-and-time. | ||
Additional Details | ||
* Last updated: Fri, 01 Mar 2019 01:31:01 GMT | ||
### Additional Details | ||
* Last updated: Tue, 21 Jul 2020 18:17:34 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Daniel Plisetsky <https://github.com/danplisetsky>. | ||
These definitions were written by [Daniel Plisetsky](https://github.com/danplisetsky), and [Justin Grant](https://github.com/justingrant). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7673
168