Add typings for timezonecomplete 1.8.0

This commit is contained in:
Rogier Schouten
2014-10-17 13:15:06 +02:00
parent 4dd796bb15
commit c399e4d7bd
4 changed files with 1396 additions and 3 deletions
+60 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for timezonecomplete 1.6.0
// Type definitions for timezonecomplete 1.8.0
// Project: https://github.com/SpiritIT/timezonecomplete
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -36,6 +36,9 @@ declare module 'timezonecomplete' {
export import NormalizeOption = timezone.NormalizeOption;
export import TimeZoneKind = timezone.TimeZoneKind;
export import TimeZone = timezone.TimeZone;
import globals = require("__timezonecomplete/globals");
export import min = globals.min;
export import max = globals.max;
}
declare module '__timezonecomplete/basics' {
@@ -117,6 +120,16 @@ declare module '__timezonecomplete/basics' {
* Throws if the month has no such day.
*/
export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number;
/**
* The week of this month. There is no official standard for this,
* but we assume the same rules for the weekNumber (i.e.
* week 1 is the week that has the 4th day of the month in it)
*
* @param year The year
* @param month The month [1-12]
* @param day The day [1-31]
* @return Week number [1-5]
*/
export function weekOfMonth(year: number, month: number, day: number): number;
/**
* The ISO 8601 week number for the given date. Week 1 is the week
@@ -277,7 +290,7 @@ declare module '__timezonecomplete/datetime' {
import basics = require("__timezonecomplete/basics");
import duration = require("__timezonecomplete/duration");
import javascript = require("__timezonecomplete/javascript");
import timesource = require("__timezonecomplete/timesource");
import timesource = require("__timezonecomplete/timesource");
import timezone = require("__timezonecomplete/timezone");
/**
* DateTime class which is time zone-aware
@@ -606,11 +619,27 @@ declare module '__timezonecomplete/datetime' {
* @return True iff this >= other
*/
greaterEqual(other: DateTime): boolean;
/**
* @return The minimum of this and other
*/
min(other: DateTime): DateTime;
/**
* @return The maximum of this and other
*/
max(other: DateTime): DateTime;
/**
* Proper ISO 8601 format string with any IANA zone converted to ISO offset
* E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam
*/
toIsoString(): string;
/**
* Return a string representation of the DateTime according to the
* specified format. The format is implemented as the LDML standard
* (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns)
*
* @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss")
* @return The string representation of this DateTime
*/
format(formatString: string): string;
/**
* Modified ISO 8601 format string with IANA name if applicable.
@@ -730,6 +759,10 @@ declare module '__timezonecomplete/duration' {
* @return True iff (this < other)
*/
lessThan(other: Duration): boolean;
/**
* @return True iff (this <= other)
*/
lessEqual(other: Duration): boolean;
/**
* @return True iff this and other represent the same time duration
*/
@@ -738,6 +771,10 @@ declare module '__timezonecomplete/duration' {
* @return True iff this > other
*/
greaterThan(other: Duration): boolean;
/**
* @return True iff this >= other
*/
greaterEqual(other: Duration): boolean;
/**
* @return The minimum (most negative) of this and other
*/
@@ -1130,3 +1167,24 @@ declare module '__timezonecomplete/timezone' {
}
}
declare module '__timezonecomplete/globals' {
import datetime = require("__timezonecomplete/datetime");
import duration = require("__timezonecomplete/duration");
/**
* Returns the minimum of two DateTimes
*/
export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime;
/**
* Returns the minimum of two Durations
*/
export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration;
/**
* Returns the maximum of two DateTimes
*/
export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime;
/**
* Returns the maximum of two Durations
*/
export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration;
}