mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add typings for timezonecomplete 1.8.0
This commit is contained in:
197
timezonecomplete/timezonecomplete-1.6.0-tests.ts
Normal file
197
timezonecomplete/timezonecomplete-1.6.0-tests.ts
Normal file
@@ -0,0 +1,197 @@
|
||||
/// <reference path="timezonecomplete-1.6.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.6.0");
|
||||
|
||||
var b: boolean;
|
||||
var n: number;
|
||||
var s: string;
|
||||
var w: tc.WeekDay;
|
||||
|
||||
b = tc.isLeapYear(2014);
|
||||
n = tc.daysInMonth(2014, 10);
|
||||
n = tc.daysInYear(2014);
|
||||
n = tc.dayOfYear(2014, 1, 2);
|
||||
w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday);
|
||||
w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday);
|
||||
n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday);
|
||||
n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday);
|
||||
n = tc.secondOfDay(13, 59, 59);
|
||||
n = tc.weekOfMonth(2014, 1, 1);
|
||||
|
||||
// DURATION
|
||||
|
||||
var d: tc.Duration;
|
||||
var d1: tc.Duration = tc.Duration.hours(24);
|
||||
var d2: tc.Duration = tc.Duration.minutes(24);
|
||||
var d3: tc.Duration = tc.Duration.seconds(24);
|
||||
var d4: tc.Duration = tc.Duration.milliseconds(24);
|
||||
var d5: tc.Duration = new tc.Duration(24);
|
||||
var d6: tc.Duration = new tc.Duration("00:01");
|
||||
var d7: tc.Duration = d6.clone();
|
||||
|
||||
n = d7.wholeHours();
|
||||
n = d7.hours();
|
||||
n = d7.minutes();
|
||||
n = d7.minute();
|
||||
n = d7.seconds();
|
||||
n = d7.second();
|
||||
n = d7.milliseconds();
|
||||
n = d7.millisecond();
|
||||
s = d7.sign();
|
||||
b = d7.lessThan(d6);
|
||||
b = d7.greaterThan(d6);
|
||||
d = d7.min(d6);
|
||||
d = d7.max(d6);
|
||||
d = d7.multiply(3);
|
||||
d = d7.divide(0.3);
|
||||
d = d7.add(d6);
|
||||
d = d7.sub(d6);
|
||||
s = d7.toString();
|
||||
|
||||
// TIMEZONE
|
||||
|
||||
var t: tc.TimeZone;
|
||||
var k: tc.TimeZoneKind;
|
||||
|
||||
t = tc.TimeZone.local();
|
||||
t = tc.TimeZone.utc();
|
||||
t = tc.TimeZone.zone(2);
|
||||
t = tc.TimeZone.zone("+01:00");
|
||||
s = t.name();
|
||||
k = t.kind();
|
||||
b = t.equals(t);
|
||||
b = t.isUtc();
|
||||
n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123);
|
||||
n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123);
|
||||
n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get);
|
||||
n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC);
|
||||
s = t.toString();
|
||||
s = tc.TimeZone.offsetToString(2);
|
||||
n = tc.TimeZone.stringToOffset("+00:01");
|
||||
|
||||
// REALTIMESOURCE
|
||||
|
||||
var date: Date = (new tc.RealTimeSource()).now();
|
||||
|
||||
// DATETIME
|
||||
|
||||
var dt: tc.DateTime;
|
||||
|
||||
var ts: tc.TimeSource = tc.DateTime.timeSource;
|
||||
|
||||
dt = tc.DateTime.nowLocal();
|
||||
dt = tc.DateTime.nowUtc();
|
||||
dt = tc.DateTime.now(tc.TimeZone.local());
|
||||
dt = new tc.DateTime();
|
||||
dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC");
|
||||
dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc());
|
||||
dt = new tc.DateTime(date, tc.DateFunctions.Get);
|
||||
dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc());
|
||||
dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123);
|
||||
dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc());
|
||||
dt = new tc.DateTime(89949284);
|
||||
dt = new tc.DateTime(89949284, tc.TimeZone.utc());
|
||||
dt = dt.clone();
|
||||
t = dt.zone();
|
||||
n = dt.offset();
|
||||
n = dt.year();
|
||||
n = dt.month();
|
||||
n = dt.day();
|
||||
n = dt.hour();
|
||||
n = dt.minute();
|
||||
n = dt.second();
|
||||
n = dt.weekNumber();
|
||||
n = dt.weekOfMonth();
|
||||
n = dt.secondOfDay();
|
||||
n = dt.dayOfYear();
|
||||
n = dt.millisecond();
|
||||
n = dt.unixUtcMillis();
|
||||
n = dt.utcYear();
|
||||
n = dt.utcMonth();
|
||||
n = dt.utcDay();
|
||||
n = dt.utcHour();
|
||||
n = dt.utcMinute();
|
||||
n = dt.utcSecond();
|
||||
n = dt.utcMillisecond();
|
||||
n = dt.utcWeekNumber();
|
||||
n = dt.utcWeekOfMonth();
|
||||
n = dt.utcSecondOfDay();
|
||||
n = dt.utcDayOfYear();
|
||||
s = dt.format("%Y-%m-%d");
|
||||
dt.convert(tc.TimeZone.local());
|
||||
dt = dt.toZone(tc.TimeZone.utc());
|
||||
date = dt.toDate();
|
||||
dt = dt.add(tc.Duration.seconds(2));
|
||||
dt = dt.add(2, tc.TimeUnit.Year);
|
||||
dt = dt.add(2, tc.TimeUnit.Month);
|
||||
dt = dt.add(2, tc.TimeUnit.Week);
|
||||
dt = dt.add(2, tc.TimeUnit.Day);
|
||||
dt = dt.add(2, tc.TimeUnit.Hour);
|
||||
dt = dt.add(2, tc.TimeUnit.Minute);
|
||||
dt = dt.add(2, tc.TimeUnit.Second);
|
||||
dt = dt.addLocal(2, tc.TimeUnit.Second);
|
||||
dt = dt.sub(tc.Duration.seconds(2));
|
||||
dt = dt.sub(2, tc.TimeUnit.Year);
|
||||
dt = dt.sub(2, tc.TimeUnit.Month);
|
||||
dt = dt.sub(2, tc.TimeUnit.Week);
|
||||
dt = dt.sub(2, tc.TimeUnit.Day);
|
||||
dt = dt.sub(2, tc.TimeUnit.Hour);
|
||||
dt = dt.sub(2, tc.TimeUnit.Minute);
|
||||
dt = dt.sub(2, tc.TimeUnit.Second);
|
||||
dt = dt.subLocal(2, tc.TimeUnit.Second);
|
||||
d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
s = dt.toIsoString();
|
||||
s = dt.toString();
|
||||
s = dt.toUtcString();
|
||||
|
||||
var wd: tc.WeekDay;
|
||||
wd = dt.weekDay();
|
||||
wd = dt.utcWeekDay();
|
||||
|
||||
// PERIOD
|
||||
|
||||
s = tc.periodDstToString(tc.PeriodDst.RegularIntervals);
|
||||
s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime);
|
||||
|
||||
var p: tc.Period;
|
||||
|
||||
p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime);
|
||||
dt = p.start();
|
||||
n = p.amount();
|
||||
var tu: tc.TimeUnit = p.unit();
|
||||
var pd: tc.PeriodDst = p.dst();
|
||||
dt = p.findFirst(tc.DateTime.nowLocal());
|
||||
dt = p.findNext(dt);
|
||||
s = p.toIsoString();
|
||||
s = p.toString();
|
||||
b = p.isBoundary(dt);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1132
timezonecomplete/timezonecomplete-1.6.0.d.ts
vendored
Normal file
1132
timezonecomplete/timezonecomplete-1.6.0.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -144,6 +144,8 @@ b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
s = dt.toIsoString();
|
||||
s = dt.toString();
|
||||
s = dt.toUtcString();
|
||||
@@ -171,8 +173,12 @@ s = p.toString();
|
||||
b = p.isBoundary(dt);
|
||||
|
||||
|
||||
|
||||
|
||||
// GLOBALS
|
||||
d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3));
|
||||
d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3));
|
||||
|
||||
dt = tc.min(new tc.DateTime(2), new tc.DateTime(3));
|
||||
dt = tc.max(new tc.DateTime(2), new tc.DateTime(3));
|
||||
|
||||
|
||||
|
||||
|
||||
62
timezonecomplete/timezonecomplete.d.ts
vendored
62
timezonecomplete/timezonecomplete.d.ts
vendored
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user