Replace our "moment" with the one provided with moment on NPM

This commit is contained in:
Andy Hanson
2016-07-20 12:47:24 -07:00
parent 17b185f0a1
commit c43032fdd6
26 changed files with 77 additions and 1623 deletions

View File

@@ -3,8 +3,6 @@
// Definitions by: Egor Komarov <https://github.com/Odrin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="moment" />
import * as moment from 'moment';
import * as angular from 'angular';

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -10,7 +10,6 @@
*/
/// <reference types="jquery"/>
/// <reference types="moment" />
import * as moment from 'moment';

View File

@@ -11,7 +11,6 @@
*/
/// <reference types="jquery"/>
/// <reference types="moment"/>
import * as moment from 'moment';

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -1,3 +1,6 @@
import * as moment from 'moment';
import * as EonasdanBootstrapDatetimepicker from './index';
// Minimum Setup
$("#datetimepicker1").datetimepicker();

View File

@@ -4,7 +4,6 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference types="jquery"/>
/// <reference types="moment"/>
import * as moment from 'moment';

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -6,7 +6,8 @@
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
"../",
"./node_modules"
],
"types": [],
"noEmit": true,

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -1,5 +1,5 @@
/// <reference types="jquery"/>
/// <reference types="moment"/>
import * as moment from 'moment';
$('#test1').livestamp(new Date('June 18, 1987'));
$('#test2').livestamp(1362282933);

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -45,12 +45,9 @@ declare module 'moment' {
within (x: moment.Range): boolean;
}
interface MomentStatic {
range(range: string): moment.Range;
range(range: Date[]): moment.Range;
range(range: Moment[]): moment.Range;
range(start: Date, end: Date): moment.Range;
range(start: Moment, end: Moment): moment.Range;
}
function range(range: string): moment.Range;
function range(range: Date[]): moment.Range;
function range(range: Moment[]): moment.Range;
function range(start: Date, end: Date): moment.Range;
function range(start: Moment, end: Moment): moment.Range;
}

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -3,8 +3,6 @@
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="moment" />
import * as moment from 'moment';
export as namespace MomentTimezone;
@@ -22,16 +20,19 @@ declare namespace MomentTimezone {
parse(timestamp: number): number
}
type MomentFormatSpecification =
string | (() => void) | (string | (() => void))[];
interface MomentTimezone {
(): moment.Moment;
(timezone: string): moment.Moment;
(date: number, timezone: string): moment.Moment;
(date: number[], timezone: string): moment.Moment;
(date: string, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment;
(date: string, format: MomentFormatSpecification, timezone: string): moment.Moment;
(date: string, format: MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment;
(date: string, format: MomentFormatSpecification, language: string, timezone: string): moment.Moment;
(date: string, format: MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment;
(date: Date, timezone: string): moment.Moment;
(date: moment.Moment, timezone: string): moment.Moment;
(date: Object, timezone: string): moment.Moment;
@@ -66,7 +67,5 @@ declare module "moment" {
zoneName() :Moment;
}
interface MomentStatic {
tz: MomentTimezone.MomentTimezone;
}
const tz: MomentTimezone.MomentTimezone;
}

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

632
moment/index.d.ts vendored
View File

@@ -1,632 +0,0 @@
// Type definitions for Moment.js 2.11.1
// Project: https://github.com/timrwood/moment
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>, Gal Talmor <https://github.com/galtalmor>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace moment;
declare var moment: moment.MomentStatic;
export = moment;
declare namespace moment {
export type MomentComparable = Moment | string | number | Date | number[];
export interface MomentDateObject {
years?: number;
/* One digit */
months?: number;
/* Day of the month */
date?: number;
hours?: number;
minutes?: number;
seconds?: number;
milliseconds?: number;
}
export interface MomentInput {
/** Year */
years?: number;
/** Year */
year?: number;
/** Year */
y?: number;
/** Month */
months?: number;
/** Month */
month?: number;
/** Month */
M?: number;
/** Week */
weeks?: number;
/** Week */
week?: number;
/** Week */
w?: number;
/** Day/Date */
days?: number;
/** Day/Date */
day?: number;
/** Day/Date */
date?: number;
/** Day/Date */
d?: number;
/** Hour */
hours?: number;
/** Hour */
hour?: number;
/** Hour */
h?: number;
/** Minute */
minutes?: number;
/** Minute */
minute?: number;
/** Minute */
m?: number;
/** Second */
seconds?: number;
/** Second */
second?: number;
/** Second */
s?: number;
/** Millisecond */
milliseconds?: number;
/** Millisecond */
millisecond?: number;
/** Millisecond */
ms?: number;
}
export interface Duration {
humanize(withSuffix?: boolean): string;
as(units: string): number;
milliseconds(): number;
asMilliseconds(): number;
seconds(): number;
asSeconds(): number;
minutes(): number;
asMinutes(): number;
hours(): number;
asHours(): number;
days(): number;
asDays(): number;
weeks(): number;
asWeeks(): number;
months(): number;
asMonths(): number;
years(): number;
asYears(): number;
add(n: number, p: string): Duration;
add(n: number): Duration;
add(d: Duration): Duration;
subtract(n: number, p: string): Duration;
subtract(n: number): Duration;
subtract(d: Duration): Duration;
toISOString(): string;
toJSON(): string;
}
export interface MomentLocale {
ordinal(n: number): string;
}
export interface MomentCreationData {
input?: string;
format?: string;
locale: MomentLocale;
isUTC: boolean;
strict?: boolean;
}
export interface Moment {
format(format?: string): string;
fromNow(withoutSuffix?: boolean): string;
startOf(unitOfTime: string): Moment;
endOf(unitOfTime: string): Moment;
/**
* Mutates the original moment by adding time. (deprecated in 2.8.0)
*
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
* @param amount the amount you want to add
*/
add(unitOfTime: string, amount: number): Moment;
/**
* Mutates the original moment by adding time.
*
* @param amount the amount you want to add
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
*/
add(amount: number|string, unitOfTime: string): Moment;
/**
* Mutates the original moment by adding time.
*
* @param objectLiteral a length of time or an object literal that describes multiple time units {days:7,months:1}
*/
add(duration: Duration|MomentInput): Moment;
/**
* Mutates the original moment by subtracting time. (deprecated in 2.8.0)
*
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
* @param amount the amount you want to subtract
*/
subtract(unitOfTime: string, amount: number): Moment;
/**
* Mutates the original moment by subtracting time.
*
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
* @param amount the amount you want to subtract
*/
subtract(amount: number|string, unitOfTime: string): Moment;
/**
* Mutates the original moment by subtracting time.
*
* @param duration a length of time or an object literal that describes multiple time units {days:7,months:1}
*/
subtract(duration: Duration|MomentInput): Moment;
calendar(start?: Moment, formats?: MomentCalendar): string;
clone(): Moment;
/**
* @return Unix timestamp, or milliseconds since the epoch.
*/
valueOf(): number;
local(): Moment; // current date/time in local mode
utc(): Moment; // current date/time in UTC mode
isValid(): boolean;
invalidAt(): number;
year(y: number): Moment;
year(): number;
quarter(): number;
quarter(q: number): Moment;
month(M: number): Moment;
month(M: string): Moment;
month(): number;
day(d: number): Moment;
day(d: string): Moment;
day(): number;
date(d: number): Moment;
date(): number;
hour(h: number): Moment;
hour(): number;
hours(h: number): Moment;
hours(): number;
minute(m: number): Moment;
minute(): number;
minutes(m: number): Moment;
minutes(): number;
second(s: number): Moment;
second(): number;
seconds(s: number): Moment;
seconds(): number;
millisecond(ms: number): Moment;
millisecond(): number;
milliseconds(ms: number): Moment;
milliseconds(): number;
weekday(): number;
weekday(d: number): Moment;
isoWeekday(): number;
isoWeekday(d: number): Moment;
weekYear(): number;
weekYear(d: number): Moment;
isoWeekYear(): number;
isoWeekYear(d: number): Moment;
week(): number;
week(d: number): Moment;
weeks(): number;
weeks(d: number): Moment;
isoWeek(): number;
isoWeek(d: number): Moment;
isoWeeks(): number;
isoWeeks(d: number): Moment;
weeksInYear(): number;
isoWeeksInYear(): number;
dayOfYear(): number;
dayOfYear(d: number): Moment;
from(f: MomentComparable, suffix?: boolean): string;
to(f: MomentComparable, suffix?: boolean): string;
toNow(withoutPrefix?: boolean): string;
diff(b: MomentComparable, unitOfTime?: string, round?: boolean): number;
toArray(): number[];
toDate(): Date;
toISOString(): string;
toJSON(): string;
unix(): number;
isLeapYear(): boolean;
zone(): number;
zone(b?: number|string): Moment;
utcOffset(): number;
utcOffset(b: number|string): Moment;
daysInMonth(): number;
isDST(): boolean;
isBefore(b?: MomentComparable, granularity?: string): boolean;
isAfter(b?: MomentComparable, granularity?: string): boolean;
isSame(b: MomentComparable, granularity?: string): boolean;
isBetween(a: MomentComparable, b: MomentComparable, granularity?: string): boolean;
/**
* @since 2.10.7+
*/
isSameOrBefore(b: MomentComparable, granularity?: string): boolean;
isSameOrAfter(b: MomentComparable, granularity?: string): boolean;
/**
* @deprecated since version 2.8.0
*/
lang(languageOrReset: string|boolean): Moment;
lang(): MomentLanguage;
locale(languageOrReset: string|boolean): Moment;
locale(): string;
/**
* @since 2.12.0+
*/
locales() : string[];
localeData(languageOrReset: string|boolean): Moment;
localeData(): MomentLanguage;
/**
* @deprecated since version 2.7.0
*/
max(date: Moment | string | number | Date | any[]): Moment;
max(date: string, format: string): Moment;
/**
* @deprecated since version 2.7.0
*/
min(date: Moment | string | number | Date | any[]): Moment;
min(date: string, format: string): Moment;
get(unit: string): number;
set(unit: string, value: number): Moment;
set(objectLiteral: MomentInput): Moment;
/**
* This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.
* @since 2.10.5+
*/
toObject(): MomentDateObject;
/**
* @since 2.10.7+
*/
creationData(): MomentCreationData;
}
export type formatFunction = () => string;
export interface MomentCalendar {
lastDay?: string | formatFunction;
sameDay?: string | formatFunction;
nextDay?: string | formatFunction;
lastWeek?: string | formatFunction;
nextWeek?: string | formatFunction;
sameElse?: string | formatFunction;
}
export interface BaseMomentLanguage {
months?: any;
monthsShort?: any;
weekdays?: any;
weekdaysShort?: any;
weekdaysMin?: any;
relativeTime?: MomentRelativeTime;
meridiem?: (hour: number, minute: number, isLowercase: boolean) => string;
calendar?: MomentCalendar;
ordinal?: (num: number) => string;
week?: MomentLanguageWeek;
}
export interface MomentLanguage extends BaseMomentLanguage {
longDateFormat?: MomentLongDateFormat;
}
export interface MomentLanguageWeek {
dow?: number;
doy?: number;
}
export interface MomentLanguageData {
/**
* Get the full localized month name of a moment object
* @param {Moment} aMoment a moment object
* @return {string} full month name
*/
months(aMoment: Moment): string;
/**
* Get the short localized month name of a moment object
* @param {Moment} aMoment a moment object
* @return {string} short month name
*/
monthsShort(aMoment: Moment): string;
/**
* Parses a month name and returns the month id (0-11)
* @param {string} longOrShortMonthString string of month to parse
* @return {number} month id (0 to 11) of input
*/
monthsParse(longOrShortMonthString: string): number;
/**
* Gets the full weekday name of a moment object (eg. Monday)
* @param {Moment} aMoment a moment object
* @return {string} full weekday name
*/
weekdays(aMoment: Moment): string;
/**
* Gets the short weekday name of a moment object (eg. Mon)
* @param {Moment} aMoment a moment object
* @return {string} short weekday name
*/
weekdaysShort(aMoment: Moment): string;
/**
* Gets the min weekday name of a moment object (eg. Mo)
* @param {Moment} aMoment a moment object
* @return {string} min weekday name
*/
weekdaysMin(aMoment: Moment): string;
/**
* Parses a weekday name and returns the weekday id (0-6)
* @param {string} longOrShortMonthString string of weekday to parse
* @return {number} weekday id (0 to 6) of input
*/
weekdaysParse(longOrShortMonthString: string): number;
/**
* Returns the full format of abbreviated date-time formats
* @param {string} dateFormat date-time format such as LT, L, LL and so on
* @return {string} full date format string
*/
longDateFormat(dateFormat: string): string;
/**
* Returns whether a string represents PM
* @param {string} amPmString date string to check
* @return {boolean} true if string represents PM
*/
isPM(amPmString: string): boolean;
/**
* Returns am/pm string for particular time-of-day in upper/lower case
* @param {number} hour hour
* @param {number} minute minute
* @param {boolean} isLowercase whether to return in lowercase
* @return {string} 'am' or 'pm'
*/
meridiem(hour: number, minute: number, isLowercase: boolean): string;
/**
* Returns a format that would be used for calendar representation.
* @param {string} key one of 'sameDay', 'nextDay', 'lastDay', 'nextWeek', 'prevWeek', 'sameElse'
* @param {Moment} aMoment a moment object
* @return {string} date format string
*/
calendar(key: string, aMoment: Moment): string;
/**
* Returns relative time string (eg. a year ago)
* @param {number} number the relative number
* @param {boolean} withoutSuffix whether to drop the suffix
* @param {string} key one of 's', 'm', 'mm', 'h', 'hh', 'd', 'dd', 'M', 'MM', 'y', 'yy'. Single letter when number is 1.
* @param {boolean} isFuture whether this represents a future date
* @return {string} humanized representation of relative time
*/
relativeTime(number: number, withoutSuffix: boolean, key: string, isFuture: boolean): string;
/**
* Converts relative time string to past or future string depending on difference
* @param {number} diff positive or negative number
* @param {string} relTime relative time string
* @return {string} humanized representation of relative time
*/
pastFuture(diff: number, relTime: string): string;
/**
* Convert number to ordinal string 1 -> 1st
* @param {number} number the number
* @return {string} ordinal string
*/
ordinal(number: number): string;
/**
* Called before parsing every input string
*/
preparse(str: string): string;
/**
* Called after formatting on every string
*/
postformat(str: string): string;
/**
* Returns week-of-year of a moment object
* @param {Moment} aMoment a moment object
* @return {number} number of the week
*/
week(aMoment: Moment): number;
/**
* Returns a translation of 'Invalid date'
* @return {string} translation of 'Invalid date'
*/
invalidDate(): string;
/**
* Returns the first day of the week (0-6, Sunday to Saturday)
* @return {number} first day of the week
*/
firstDayOfWeek(): number;
/**
* This and the first day of week are used to determine which is
* the first week of the year. dow == 1 and doy == 4 means week starts
* Monday and first week that has Thursday is the first week of the
* year (but doy is NOT simply Thursday).
* @return {number} number between 0-15
*/
firstDayOfYear(): number;
}
export interface MomentLongDateFormat {
L: string;
LL: string;
LLL: string;
LLLL: string;
LT: string;
LTS: string;
l?: string;
ll?: string;
lll?: string;
llll?: string;
lt?: string;
lts?: string;
}
export interface MomentRelativeTime {
future: any;
past: any;
s: any;
m: any;
mm: any;
h: any;
hh: any;
d: any;
dd: any;
M: any;
MM: any;
y: any;
yy: any;
}
export interface MomentBuiltinFormat {
__momentBuiltinFormatBrand: any;
}
export type MomentFormatSpecification = string | MomentBuiltinFormat | (string | MomentBuiltinFormat)[];
export interface MomentStatic {
version: string;
fn: Moment;
(): Moment;
(date: number[]|number|Date|Moment|Object): Moment;
(date: string, format?: MomentFormatSpecification, strict?: boolean): Moment;
(date: string, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment;
utc(): Moment;
utc(date: number[]|number|Date|Moment|Object): Moment;
utc(date: string, format?: string, strict?: boolean): Moment;
utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
utc(date: string, formats: string[], strict?: boolean): Moment;
utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
unix(timestamp: number): Moment;
invalid(parsingFlags?: Object): Moment;
isMoment(m?: any): boolean;
isDate(m: any): boolean;
isDuration(d?: any): boolean;
/**
* @deprecated since version 2.8.0
*/
lang(language?: string, definition?: MomentLanguage): string;
locale(language?: string[]|string): string;
locale(language?: string, definition?: MomentLanguage): string;
localeData(language?: string): MomentLanguageData;
longDateFormat: any;
relativeTime: any;
meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
calendar: any;
ordinal: (num: number) => string;
duration(milliseconds: Number): Duration;
duration(num: Number, unitOfTime: string): Duration;
duration(input: MomentInput): Duration;
duration(object: any): Duration;
duration(): Duration;
parseZone(date: string): Moment;
months(index: number): string;
months(format?: string): string[];
months(format: string, index: number): string;
monthsShort(index: number): string;
monthsShort(format?: string): string[];
monthsShort(format: string, index: number): string;
weekdays(index: number): string;
weekdays(format?: string): string[];
weekdays(format: string, index: number): string;
weekdaysShort(): string[];
weekdaysShort(index: number): string;
weekdaysShort(format: string): string[];
weekdaysShort(format: string, index: number): string;
weekdaysMin(index: number): string;
weekdaysMin(format?: string): string[];
weekdaysMin(format: string, index: number): string;
min(...moments: Moment[]): Moment;
min(moments: Moment[]): Moment;
max(...moments: Moment[]): Moment;
max(moments: Moment[]): Moment;
normalizeUnits(unit: string): string;
relativeTimeThreshold(threshold: string): number | boolean;
relativeTimeThreshold(threshold: string, limit: number): boolean;
/**
* @since 2.10.7+
*/
now(): number;
/**
* Constant used to enable explicit ISO_8601 format parsing.
*/
ISO_8601: MomentBuiltinFormat;
defaultFormat: string;
}
}

View File

@@ -1,464 +0,0 @@
import moment = require('./');
moment().add('hours', 1).fromNow();
var day = new Date(2011, 9, 16);
var dayWrapper = moment(day);
var otherDay = moment(new Date(2020, 3, 7));
var day1 = moment(1318781876406);
var day2 = moment.unix(1318781876);
var day3 = moment("Dec 25, 1995");
var day4 = moment("12-25-1995", "MM-DD-YYYY");
var day5 = moment("12-25-1995", ["MM-DD-YYYY", "YYYY-MM-DD"]);
var day6 = moment("05-06-1995", ["MM-DD-YYYY", "DD-MM-YYYY"]);
var now = moment();
var day7 = moment([2010, 1, 14, 15, 25, 50, 125]);
var day8 = moment([2010]);
var day9 = moment([2010, 6]);
var day10 = moment([2010, 6, 10]);
var array = [2010, 1, 14, 15, 25, 50, 125];
var day11 = moment(Date.UTC.apply({}, array));
var day12 = moment.unix(1318781876);
moment({ years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123 });
moment("20140101", "YYYYMMDD", true);
moment("20140101", "YYYYMMDD", "en");
moment("20140101", "YYYYMMDD", "en", true);
moment("20140101", ["YYYYMMDD"], true);
moment("20140101", ["YYYYMMDD"], "en");
moment("20140101", ["YYYYMMDD"], "en", true);
moment(day.toISOString(), moment.ISO_8601);
moment(day.toISOString(), moment.ISO_8601, true);
moment(day.toISOString(), moment.ISO_8601, "en", true);
moment(day.toISOString(), [moment.ISO_8601]);
moment(day.toISOString(), [moment.ISO_8601], true);
moment(day.toISOString(), [moment.ISO_8601], "en", true);
var a = moment([2012]);
var b = moment(a);
a.year(2000);
b.year(); // 2012
moment.utc();
moment.utc(12345);
moment.utc([12, 34, 56]);
moment.utc({ years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123 });
moment.utc("1-2-3");
moment.utc("1-2-3", "3-2-1");
moment.utc("1-2-3", "3-2-1", true);
moment.utc("1-2-3", "3-2-1", "en");
moment.utc("1-2-3", "3-2-1", "en", true);
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"]);
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"], true);
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"], "en");
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"], "en", true);
var a2 = moment.utc([2011, 0, 1, 8]);
a.hours();
a.local();
a.hours();
moment("2011-10-10", "YYYY-MM-DD").isValid();
moment("2011-10-50", "YYYY-MM-DD").isValid();
moment("2011-10-10T10:20:90").isValid();
moment([2011, 0, 1]).isValid();
moment([2011, 0, 50]).isValid();
moment("not a date").isValid();
moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).seconds(0);
moment().add('days', 7);
moment().add('days', 7).add('months', 1);
moment().add({days:7,months:1});
moment().add('milliseconds', 1000000);
moment().add('days', 360);
moment([2010, 0, 31]);
moment([2010, 0, 31]).add('months', 1);
var m = moment(new Date(2011, 2, 12, 5, 0, 0));
m.hours();
m.add('days', 1).hours();
var m2 = moment(new Date(2011, 2, 12, 5, 0, 0));
m2.hours();
m2.add('hours', 24).hours();
var duration = moment.duration({'days': 1});
moment([2012, 0, 31]).add(duration);
moment().add('seconds', 1);
moment().add('seconds', '1');
moment().add(1, 'seconds');
moment().add('1', 'seconds');
moment().add('seconds', '1');
moment().subtract('days', 7);
moment().seconds(30);
moment().minutes(30);
moment().hours(12);
moment().date(5);
moment().day(5);
moment().day("Sunday");
moment().month(5);
moment().month("January");
moment().year(1984);
moment().startOf('year');
moment().month(0).date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
moment().startOf('hour');
moment().minutes(0).seconds(0).milliseconds(0);
moment().weekday();
moment().weekday(0);
moment().isoWeekday(1);
moment().isoWeekday();
moment().weekYear(2);
moment().weekYear();
moment().isoWeekYear(3);
moment().isoWeekYear();
moment().week();
moment().week(45);
moment().weeks();
moment().weeks(45);
moment().isoWeek();
moment().isoWeek(45);
moment().isoWeeks();
moment().isoWeeks(45);
var getMilliseconds: number = moment().milliseconds();
var getSeconds: number = moment().seconds();
var getMinutes: number = moment().minutes();
var getHours: number = moment().hours();
var getDate: number = moment().date();
var getDay: number = moment().day();
var getMonth: number = moment().month();
var getQuater: number = moment().quarter();
var getYear: number = moment().year();
moment().hours(0).minutes(0).seconds(0).milliseconds(0);
var a3 = moment([2011, 0, 1, 8]);
a3.hours();
a3.utc();
a3.hours();
var a4 = moment([2010, 1, 14, 15, 25, 50, 125]);
a4.format("dddd, MMMM Do YYYY, h:mm:ss a");
a4.format("ddd, hA");
moment().format('\\L');
moment().format('[today] DDDD');
var a5 = moment([2007, 0, 29]);
var b5 = moment([2007, 0, 28]);
a5.from(b5);
var a6 = moment([2007, 0, 29]);
var b6 = moment([2007, 0, 28]);
a6.from(b6);
a6.from([2007, 0, 28]);
a6.from(new Date(2007, 0, 28));
a6.from("1-28-2007");
var a7 = moment();
var b7 = moment("10-10-1900", "MM-DD-YYYY");
a7.from(b7);
var start = moment([2007, 0, 5]);
var end = moment([2007, 0, 10]);
start.from(end);
start.from(end, true);
moment([2007, 0, 29]).fromNow();
moment([2007, 0, 29]).fromNow();
moment([2007, 0, 29]).fromNow(true);
var a8 = moment([2007, 0, 29]);
var b8 = moment([2007, 0, 28]);
a8.diff(b8) ;
a8.diff(b8, 'days');
a8.diff(b8, 'years')
a8.diff(b8, 'years', true);
moment([2007, 0, 29]).toDate();
moment([2007, 1, 23]).toISOString();
moment(1318874398806).valueOf();
moment(1318874398806).unix();
moment([2000]).isLeapYear();
moment().zone();
moment().utcOffset();
moment("2012-2", "YYYY-MM").daysInMonth();
moment([2011, 2, 12]).isDST();
moment.isMoment();
moment.isMoment(new Date());
moment.isMoment(moment());
moment.isDate(new Date());
moment.isDate(/regexp/);
moment.isDuration();
moment.isDuration(new Date());
moment.isDuration(moment.duration());
moment().isBetween(moment(), moment());
moment().isBetween(new Date(), new Date());
moment().isBetween([1,1,2000], [1,1,2001], "year");
moment.localeData('fr');
moment(1316116057189).fromNow();
moment.localeData('en');
var globalLang = moment();
var localLang = moment();
localLang.localeData('fr');
localLang.format('LLLL');
globalLang.format('LLLL');
moment.duration(100);
moment.duration(2, 'seconds');
moment.duration({
seconds: 2,
minutes: 2,
hours: 2,
days: 2,
weeks: 2,
months: 2,
years: 2
});
moment.duration(1, "minutes").humanize();
moment.duration(500).milliseconds();
moment.duration(500).asMilliseconds();
moment.duration(500).seconds();
moment.duration(500).asSeconds();
moment.duration().minutes();
moment.duration().asMinutes();
var adur = moment.duration(3, 'd');
var bdur = moment.duration(2, 'd');
adur.subtract(bdur).days();
adur.subtract(1).days();
adur.subtract(1, 'd').days();
// Selecting a language
moment.locale();
moment.locale('en');
moment.locale(['en', 'fr']);
// Defining a custom language:
moment.locale('en', {
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
longDateFormat: {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D YYYY",
LLL: "MMMM D YYYY LT",
LLLL: "dddd, MMMM D YYYY LT"
},
relativeTime: {
future: "in %s",
past: "%s ago",
s: "seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
},
meridiem: function (hour, minute, isLower) {
if (hour < 9) {
return "??";
} else if (hour < 11 && minute < 30) {
return "??";
} else if (hour < 13 && minute < 30) {
return "??";
} else if (hour < 18) {
return "??";
} else {
return "??";
}
},
calendar: {
lastDay: '[Yesterday at] LT',
sameDay: '[Today at] LT',
nextDay: '[Tomorrow at] LT',
lastWeek: '[last] dddd [at] LT',
nextWeek: 'dddd [at] LT',
sameElse: 'L'
},
ordinal: function (number) {
var b = number % 10;
return (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
}
});
moment.locale('en', {
months : [
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
]
});
moment.locale('en', {
months : function (momentToFormat: moment.Moment, format: string) {
// momentToFormat is the moment currently being formatted
// format is the formatting string
if (/^MMMM/.test(format)) { // if the format starts with 'MMMM'
return this.nominative[momentToFormat.month()];
} else {
return this.subjective[momentToFormat.month()];
}
}
});
moment.locale('en', {
monthsShort : [
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
]
});
moment.locale('en', {
monthsShort : function (momentToFormat: moment.Moment, format: string) {
if (/^MMMM/.test(format)) {
return this.nominative[momentToFormat.month()];
} else {
return this.subjective[momentToFormat.month()];
}
}
});
moment.locale('en', {
weekdays : [
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
]
});
moment.locale('en', {
weekdays : function (momentToFormat: moment.Moment) {
return this.weekdays[momentToFormat.day()];
}
});
moment.locale('en', {
weekdaysShort : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
});
moment.locale('en', {
weekdaysShort : function (momentToFormat: moment.Moment) {
return this.weekdaysShort[momentToFormat.day()];
}
});
moment.locale('en', {
weekdaysMin : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
});
moment.locale('en', {
weekdaysMin : function (momentToFormat: moment.Moment) {
return this.weekdaysMin[momentToFormat.day()];
}
});
moment.locale('en', {
longDateFormat : {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
l: "M/D/YYYY",
LL: "MMMM Do YYYY",
ll: "MMM D YYYY",
LLL: "MMMM Do YYYY LT",
lll: "MMM D YYYY LT",
LLLL: "dddd, MMMM Do YYYY LT",
llll: "ddd, MMM D YYYY LT"
}
});
moment.locale('en', {
longDateFormat : {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM Do YYYY",
LLL: "MMMM Do YYYY LT",
LLLL: "dddd, MMMM Do YYYY LT"
}
});
moment.locale('en', {
relativeTime : {
future: "in %s",
past: "%s ago",
s: "seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
}
});
moment.locale('en', {
meridiem : function (hour, minute, isLowercase) {
if (hour < 9) {
return "早上";
} else if (hour < 11 && minute < 30) {
return "上午";
} else if (hour < 13 && minute < 30) {
return "中午";
} else if (hour < 18) {
return "下午";
} else {
return "晚上";
}
}
});
moment.locale('en', {
calendar : {
lastDay : '[Yesterday at] LT',
sameDay : '[Today at] LT',
nextDay : function () {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastWeek : '[last] dddd [at] LT',
nextWeek : 'dddd [at] LT',
sameElse : 'L'
}
});
moment.locale('en', {
ordinal : function (number) {
var b = number % 10;
var output = (~~ (number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
moment.fn.toJSON = function() {
return this.format();
};
console.log(moment.version);

View File

@@ -1,477 +0,0 @@
import * as moment from './';
moment().add('hours', 1).fromNow();
var day = new Date(2011, 9, 16);
var dayWrapper = moment(day);
var otherDay = moment(new Date(2020, 3, 7));
var day1 = moment(1318781876406);
var day2 = moment.unix(1318781876);
var day3 = moment("Dec 25, 1995");
var day4 = moment("12-25-1995", "MM-DD-YYYY");
var day5 = moment("12-25-1995", ["MM-DD-YYYY", "YYYY-MM-DD"]);
var day6 = moment("05-06-1995", ["MM-DD-YYYY", "DD-MM-YYYY"]);
var now = moment();
var day7 = moment([2010, 1, 14, 15, 25, 50, 125]);
var day8 = moment([2010]);
var day9 = moment([2010, 6]);
var day10 = moment([2010, 6, 10]);
var array = [2010, 1, 14, 15, 25, 50, 125];
var day11 = moment(Date.UTC.apply({}, array));
var day12 = moment.unix(1318781876);
moment({ years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123 });
moment("20140101", "YYYYMMDD", true);
moment("20140101", "YYYYMMDD", "en");
moment("20140101", "YYYYMMDD", "en", true);
moment("20140101", ["YYYYMMDD"], true);
moment("20140101", ["YYYYMMDD"], "en");
moment("20140101", ["YYYYMMDD"], "en", true);
moment(day.toISOString(), moment.ISO_8601);
moment(day.toISOString(), moment.ISO_8601, true);
moment(day.toISOString(), moment.ISO_8601, "en", true);
moment(day.toISOString(), [moment.ISO_8601]);
moment(day.toISOString(), [moment.ISO_8601], true);
moment(day.toISOString(), [moment.ISO_8601], "en", true);
var a = moment([2012]);
var b = moment(a);
a.year(2000);
b.year(); // 2012
moment.utc();
moment.utc(12345);
moment.utc([12, 34, 56]);
moment.utc({ years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123 });
moment.utc("1-2-3");
moment.utc("1-2-3", "3-2-1");
moment.utc("1-2-3", "3-2-1", true);
moment.utc("1-2-3", "3-2-1", "en");
moment.utc("1-2-3", "3-2-1", "en", true);
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"]);
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"], true);
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"], "en");
moment.utc("01-01-2014", ["DD-MM-YYYY", "MM-DD-YYYY"], "en", true);
var a2 = moment.utc([2011, 0, 1, 8]);
a.hours();
a.local();
a.hours();
moment("2011-10-10", "YYYY-MM-DD").isValid();
moment("2011-10-50", "YYYY-MM-DD").isValid();
moment("2011-10-10T10:20:90").isValid();
moment([2011, 0, 1]).isValid();
moment([2011, 0, 50]).isValid();
moment("not a date").isValid();
moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).seconds(0);
moment().add('days', 7);
moment().add('days', 7).add('months', 1);
moment().add({days:7,months:1});
moment().add('milliseconds', 1000000);
moment().add('days', 360);
moment([2010, 0, 31]);
moment([2010, 0, 31]).add('months', 1);
var m = moment(new Date(2011, 2, 12, 5, 0, 0));
m.hours();
m.add('days', 1).hours();
var m2 = moment(new Date(2011, 2, 12, 5, 0, 0));
m2.hours();
m2.add('hours', 24).hours();
var duration = moment.duration({'days': 1});
moment([2012, 0, 31]).add(duration);
moment().add('seconds', 1);
moment().add('seconds', '1');
moment().add(1, 'seconds');
moment().add('1', 'seconds');
moment().add('seconds', '1');
moment().subtract('days', 7);
moment().seconds(30);
moment().minutes(30);
moment().hours(12);
moment().date(5);
moment().day(5);
moment().day("Sunday");
moment().month(5);
moment().month("January");
moment().year(1984);
moment().startOf('year');
moment().month(0).date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
moment().startOf('hour');
moment().minutes(0).seconds(0).milliseconds(0);
moment().weekday();
moment().weekday(0);
moment().isoWeekday(1);
moment().isoWeekday();
moment().weekYear(2);
moment().weekYear();
moment().isoWeekYear(3);
moment().isoWeekYear();
moment().week();
moment().week(45);
moment().weeks();
moment().weeks(45);
moment().isoWeek();
moment().isoWeek(45);
moment().isoWeeks();
moment().isoWeeks(45);
moment().dayOfYear();
moment().dayOfYear(45);
moment().set('year', 2013);
moment().set('month', 3); // April
moment().set('date', 1);
moment().set('hour', 13);
moment().set('minute', 20);
moment().set('second', 30);
moment().set('millisecond', 123);
moment().set({'year': 2013, 'month': 3});
var getMilliseconds: number = moment().milliseconds();
var getSeconds: number = moment().seconds();
var getMinutes: number = moment().minutes();
var getHours: number = moment().hours();
var getDate: number = moment().date();
var getDay: number = moment().day();
var getMonth: number = moment().month();
var getQuater: number = moment().quarter();
var getYear: number = moment().year();
moment().hours(0).minutes(0).seconds(0).milliseconds(0);
var a3 = moment([2011, 0, 1, 8]);
a3.hours();
a3.utc();
a3.hours();
var a4 = moment([2010, 1, 14, 15, 25, 50, 125]);
a4.format("dddd, MMMM Do YYYY, h:mm:ss a");
a4.format("ddd, hA");
moment().format('\\L');
moment().format('[today] DDDD');
var a5 = moment([2007, 0, 29]);
var b5 = moment([2007, 0, 28]);
a5.from(b5);
var a6 = moment([2007, 0, 29]);
var b6 = moment([2007, 0, 28]);
a6.from(b6);
a6.from([2007, 0, 28]);
a6.from(new Date(2007, 0, 28));
a6.from("1-28-2007");
var a7 = moment();
var b7 = moment("10-10-1900", "MM-DD-YYYY");
a7.from(b7);
var start = moment([2007, 0, 5]);
var end = moment([2007, 0, 10]);
start.from(end);
start.from(end, true);
moment([2007, 0, 29]).fromNow();
moment([2007, 0, 29]).fromNow();
moment([2007, 0, 29]).fromNow(true);
var a8 = moment([2007, 0, 29]);
var b8 = moment([2007, 0, 28]);
a8.diff(b8) ;
a8.diff(b8, 'days');
a8.diff(b8, 'years')
a8.diff(b8, 'years', true);
moment([2007, 0, 29]).toDate();
moment([2007, 1, 23]).toISOString();
moment(1318874398806).valueOf();
moment(1318874398806).unix();
moment([2000]).isLeapYear();
moment().zone();
moment().utcOffset();
moment("2012-2", "YYYY-MM").daysInMonth();
moment([2011, 2, 12]).isDST();
moment.isMoment();
moment.isMoment(new Date());
moment.isMoment(moment());
moment.isDate(new Date());
moment.isDate(/regexp/);
moment.isDuration();
moment.isDuration(new Date());
moment.isDuration(moment.duration());
moment().isBetween(moment(), moment());
moment().isBetween(new Date(), new Date());
moment().isBetween([1,1,2000], [1,1,2001], "year");
moment.localeData('fr');
moment(1316116057189).fromNow();
moment.localeData('en');
var globalLang = moment();
var localLang = moment();
localLang.localeData('fr');
localLang.format('LLLL');
globalLang.format('LLLL');
moment.duration(100);
moment.duration(2, 'seconds');
moment.duration({
seconds: 2,
minutes: 2,
hours: 2,
days: 2,
weeks: 2,
months: 2,
years: 2
});
moment.duration(1, "minutes").humanize();
moment.duration(500).milliseconds();
moment.duration(500).asMilliseconds();
moment.duration(500).seconds();
moment.duration(500).asSeconds();
moment.duration().minutes();
moment.duration().asMinutes();
moment.duration().toISOString();
moment.duration().toJSON();
var adur = moment.duration(3, 'd');
var bdur = moment.duration(2, 'd');
adur.subtract(bdur).days();
adur.subtract(1).days();
adur.subtract(1, 'd').days();
// Selecting a language
moment.locale();
moment.locale('en');
moment.locale(['en', 'fr']);
// Defining a custom language:
moment.locale('en', {
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
longDateFormat: {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D YYYY",
LLL: "MMMM D YYYY LT",
LLLL: "dddd, MMMM D YYYY LT"
},
relativeTime: {
future: "in %s",
past: "%s ago",
s: "seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
},
meridiem: function (hour, minute, isLower) {
if (hour < 9) {
return "??";
} else if (hour < 11 && minute < 30) {
return "??";
} else if (hour < 13 && minute < 30) {
return "??";
} else if (hour < 18) {
return "??";
} else {
return "??";
}
},
calendar: {
lastDay: '[Yesterday at] LT',
sameDay: '[Today at] LT',
nextDay: '[Tomorrow at] LT',
lastWeek: '[last] dddd [at] LT',
nextWeek: 'dddd [at] LT',
sameElse: 'L'
},
ordinal: function (number) {
var b = number % 10;
return (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
},
week: {
dow: 1,
doy: 4
}
});
moment.locale('en', {
months : [
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
]
});
moment.locale('en', {
months : function (momentToFormat: moment.Moment, format: string) {
// momentToFormat is the moment currently being formatted
// format is the formatting string
if (/^MMMM/.test(format)) { // if the format starts with 'MMMM'
return this.nominative[momentToFormat.month()];
} else {
return this.subjective[momentToFormat.month()];
}
}
});
moment.locale('en', {
monthsShort : [
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
]
});
moment.locale('en', {
monthsShort : function (momentToFormat: moment.Moment, format: string) {
if (/^MMMM/.test(format)) {
return this.nominative[momentToFormat.month()];
} else {
return this.subjective[momentToFormat.month()];
}
}
});
moment.locale('en', {
weekdays : [
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
]
});
moment.locale('en', {
weekdays : function (momentToFormat: moment.Moment) {
return this.weekdays[momentToFormat.day()];
}
});
moment.locale('en', {
weekdaysShort : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
});
moment.locale('en', {
weekdaysShort : function (momentToFormat: moment.Moment) {
return this.weekdaysShort[momentToFormat.day()];
}
});
moment.locale('en', {
weekdaysMin : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
});
moment.locale('en', {
weekdaysMin : function (momentToFormat: moment.Moment) {
return this.weekdaysMin[momentToFormat.day()];
}
});
moment.locale('en', {
longDateFormat : {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
l: "M/D/YYYY",
LL: "MMMM Do YYYY",
ll: "MMM D YYYY",
LLL: "MMMM Do YYYY LT",
lll: "MMM D YYYY LT",
LLLL: "dddd, MMMM Do YYYY LT",
llll: "ddd, MMM D YYYY LT"
}
});
moment.locale('en', {
longDateFormat : {
LTS: "h:mm A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM Do YYYY",
LLL: "MMMM Do YYYY LT",
LLLL: "dddd, MMMM Do YYYY LT"
}
});
moment.locale('en', {
relativeTime : {
future: "in %s",
past: "%s ago",
s: "seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
}
});
moment.locale('en', {
meridiem : function (hour, minute, isLowercase) {
if (hour < 9) {
return "早上";
} else if (hour < 11 && minute < 30) {
return "上午";
} else if (hour < 13 && minute < 30) {
return "中午";
} else if (hour < 18) {
return "下午";
} else {
return "晚上";
}
}
});
moment.locale('en', {
calendar : {
lastDay : '[Yesterday at] LT',
sameDay : '[Today at] LT',
nextDay : function () {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastWeek : '[last] dddd [at] LT',
nextWeek : 'dddd [at] LT',
sameElse : 'L'
}
});
moment.locale('en', {
ordinal : function (number) {
var b = number % 10;
var output = (~~ (number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
console.log(moment.version);

View File

@@ -1,19 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"moment-tests.ts"
]
}

View File

@@ -4,6 +4,11 @@
"libraryName": "Angular 2",
"typingsPackageName": "angular2",
"sourceRepoURL": "https://github.com/angular/angular"
},
{
"libraryName": "Moment",
"typingsPackageName": "moment",
"sourceRepoURL": "https://github.com/moment/moment"
}
]
}

5
pikaday/package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}

View File

@@ -1,7 +1,7 @@
/// <reference types="jquery" />
import * as Pikaday from "./";
import * as moment from "../moment";
import * as moment from "moment";
new Pikaday({field: document.getElementById('datepicker')});
new Pikaday({field: $('#datepicker')[0]});

8
twix/index.d.ts vendored
View File

@@ -3,8 +3,6 @@
// Definitions by: j3ko <https://github.com/j3ko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="moment" />
import { Moment, Duration } from 'moment';
export interface TwixFormatOptions {
@@ -122,10 +120,8 @@ declare module "moment" {
twix(date: string, format: string, options: TwixParseAndFormatOptions): Twix;
}
interface MomentStatic {
twix(start: Moment, end: Moment): Twix;
twixClass: TwixStatic;
}
function twix(start: Moment, end: Moment): Twix;
const twixClass: TwixStatic;
interface Duration {
afterMoment(date: string): string;

5
twix/package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}