Interface IDateJSStatic

DateJS Public Static Methods

Hierarchy

  • Date
    • IDateJSStatic

Index

Methods

Methods

public compare(date1: IDateJS, date2: IDateJS): number

Compares the first date to the second date and returns an number indication of their relative values. -1 = this is lessthan date. 0 = values are equal. 1 = this is greaterthan date.

Parameters

Returns

number

public equals(date1: IDateJS, date2?: IDateJS): boolean

Compares the first Date object to the second Date object and returns true if they are equal.

Parameters

Returns

boolean

public getDate(): number

Gets the day-of-the-month, using local time.

Returns

number

public getDay(): number

Gets the day of the week, using local time.

Returns

number

public getDayNumberFromName(dayName: string): number

Gets the day number (0-6) if given a culture-specific string which is a valid full or abbreviated day name.

Parameters

  • dayName: string

Returns

number

public getDaysInMonth(year: number, month: number): number

Gets the number of days in the month, given a year and month value. Automatically corrects for leap year.

Parameters

  • year: number
  • month: number

Returns

number

public getFullYear(): number

Gets the year, using local time.

Returns

number

public getHours(): number

Gets the hours in a date, using local time.

Returns

number

public getMilliseconds(): number

Gets the milliseconds of a Date, using local time.

Returns

number

public getMinutes(): number

Gets the minutes of a Date object, using local time.

Returns

number

public getMonth(): number

Gets the month, using local time.

Returns

number

public getMonthNumberFromName(monthName: string): number

Gets the month number (0-11) if given a culture-specific string which is a valid full or abbreviated month name.

Parameters

  • monthName: string

Returns

number

public getSeconds(): number

Gets the seconds of a Date object, using local time.

Returns

number

public getTime(): number

Gets the time value in milliseconds.

Returns

number

public getTimezoneAbbreviation(timezoneOffset: number, isDayLightSavingsTime: boolean): string

Returns a culture-specific timezone abbreviation based on a given offset and a boolean indicating whether daylight savings time is in effect.

Parameters

  • timezoneOffset: number
  • isDayLightSavingsTime: boolean

Returns

string

public getTimezoneOffset(timezoneAbbreviation?: string, isDayLightSavingsTime?: boolean): number

Gets the timezone offset if given a culture-specific string which is a valid full or abbreviated timezone name and a boolean indicating whether daylight savings time is in effect.

Parameters

  • timezoneAbbreviation?: string optional
  • isDayLightSavingsTime?: boolean optional

Returns

number

public getUTCDate(): number

Gets the day-of-the-month, using Universal Coordinated Time (UTC).

Returns

number

public getUTCDay(): number

Gets the day of the week using Universal Coordinated Time (UTC).

Returns

number

public getUTCFullYear(): number

Gets the year using Universal Coordinated Time (UTC).

Returns

number

public getUTCHours(): number

Gets the hours value in a Date object using Universal Coordinated Time (UTC).

Returns

number

public getUTCMilliseconds(): number

Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).

Returns

number

public getUTCMinutes(): number

Gets the minutes of a Date object using Universal Coordinated Time (UTC).

Returns

number

public getUTCMonth(): number

Gets the month of a Date object using Universal Coordinated Time (UTC).

Returns

number

public getUTCSeconds(): number

Gets the seconds of a Date object using Universal Coordinated Time (UTC).

Returns

number

public isLeapYear(year: number): boolean

Returns true if the given year is a leap year, false otherwise.

Parameters

  • year: number

Returns

boolean

public parse(dateString: string): IDateJS

Converts the specified string value into its JavaScript Date equivalent using culture-specific format information.

Parameters

  • dateString: string

Returns

IDateJS

public parseExact(dateString: string, formatString: string): IDateJS

Converts the specified string value into its JavaScript Date equivalent using the specified format. The format of the string value must match one of the supplied formats exactly.

Parameters

  • dateString: string
  • formatString: string

Returns

IDateJS

public parseExact(dateString: string, formatArray: Array<string>): IDateJS

Converts the specified string value into its JavaScript Date equivalent using the specified formats (array). The format of the string value must match one of the supplied formats exactly.

Parameters

  • dateString: string
  • formatArray: Array<string>

Returns

IDateJS

public setDate(date: number): number

Sets the numeric day-of-the-month value of the Date object using local time.

Parameters

  • date: number

    A numeric value equal to the day of the month.

Returns

number

public setFullYear(year: number, month?: number, date?: number): number

Sets the year of the Date object using local time.

Parameters

  • year: number

    A numeric value for the year.

  • month?: number optional

    A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.

  • date?: number optional

    A numeric value equal for the day of the month.

Returns

number

public setHours(hours: number, min?: number, sec?: number, ms?: number): number

Sets the hour value in the Date object using local time.

Parameters

  • hours: number

    A numeric value equal to the hours value.

  • min?: number optional

    A numeric value equal to the minutes value.

  • sec?: number optional

    A numeric value equal to the seconds value.

  • ms?: number optional

    A numeric value equal to the milliseconds value.

Returns

number

public setMilliseconds(ms: number): number

Sets the milliseconds value in the Date object using local time.

Parameters

  • ms: number

    A numeric value equal to the millisecond value.

Returns

number

public setMinutes(min: number, sec?: number, ms?: number): number

Sets the minutes value in the Date object using local time.

Parameters

  • min: number

    A numeric value equal to the minutes value.

  • sec?: number optional

    A numeric value equal to the seconds value.

  • ms?: number optional

    A numeric value equal to the milliseconds value.

Returns

number

public setMonth(month: number, date?: number): number

Sets the month value in the Date object using local time.

Parameters

  • month: number

    A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.

  • date?: number optional

    A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.

Returns

number

public setSeconds(sec: number, ms?: number): number

Sets the seconds value in the Date object using local time.

Parameters

  • sec: number

    A numeric value equal to the seconds value.

  • ms?: number optional

    A numeric value equal to the milliseconds value.

Returns

number

public setTime(time: number): number

Sets the date and time value in the Date object.

Parameters

  • time: number

    A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.

Returns

number

public setUTCDate(date: number): number

Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).

Parameters

  • date: number

    A numeric value equal to the day of the month.

Returns

number

public setUTCFullYear(year: number, month?: number, date?: number): number

Sets the year value in the Date object using Universal Coordinated Time (UTC).

Parameters

  • year: number

    A numeric value equal to the year.

  • month?: number optional

    A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.

  • date?: number optional

    A numeric value equal to the day of the month.

Returns

number

public setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number

Sets the hours value in the Date object using Universal Coordinated Time (UTC).

Parameters

  • hours: number

    A numeric value equal to the hours value.

  • min?: number optional

    A numeric value equal to the minutes value.

  • sec?: number optional

    A numeric value equal to the seconds value.

  • ms?: number optional

    A numeric value equal to the milliseconds value.

Returns

number

public setUTCMilliseconds(ms: number): number

Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).

Parameters

  • ms: number

    A numeric value equal to the millisecond value.

Returns

number

public setUTCMinutes(min: number, sec?: number, ms?: number): number

Sets the minutes value in the Date object using Universal Coordinated Time (UTC).

Parameters

  • min: number

    A numeric value equal to the minutes value.

  • sec?: number optional

    A numeric value equal to the seconds value.

  • ms?: number optional

    A numeric value equal to the milliseconds value.

Returns

number

public setUTCMonth(month: number, date?: number): number

Sets the month value in the Date object using Universal Coordinated Time (UTC).

Parameters

  • month: number

    A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.

  • date?: number optional

    A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.

Returns

number

public setUTCSeconds(sec: number, ms?: number): number

Sets the seconds value in the Date object using Universal Coordinated Time (UTC).

Parameters

  • sec: number

    A numeric value equal to the seconds value.

  • ms?: number optional

    A numeric value equal to the milliseconds value.

Returns

number

public toDateString(): string

Returns a date as a string value.

Returns

string

public toISOString(): string

Returns a date as a string value in ISO format.

Returns

string

public toJSON(key?: any): string

Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

Parameters

  • key?: any optional

Returns

string

public toLocaleDateString(): string

Returns a date as a string value appropriate to the host environment's current locale.

Returns

string

public toLocaleString(): string

Returns a value as a string value appropriate to the host environment's current locale.

Returns

string

public toLocaleTimeString(): string

Returns a time as a string value appropriate to the host environment's current locale.

Returns

string

public toString(): string

Returns a string representation of a date. The format of the string depends on the locale.

Returns

string

public toTimeString(): string

Returns a time as a string value.

Returns

string

public toUTCString(): string

Returns a date converted to a string using Universal Coordinated Time (UTC).

Returns

string

public today(): IDateJS

Gets a date that is set to the current date. The time is set to the start of the day (00:00 or 12:00 AM)

Returns

IDateJS

public validateDay(day: number, fullYear: number, monthNumber: number): boolean

Validates the number is within an acceptable range for the days in a month [0-MaxDaysInMonth].

Parameters

  • day: number
  • fullYear: number
  • monthNumber: number

Returns

boolean

public validateHour(hour: number): boolean

Validates the number is within an acceptable range for hours[0 - 23].Returns true if within range, otherwise false.

Parameters

  • hour: number

Returns

boolean

public validateMillisecond(milliseconds: number): boolean

Validates the number is within an acceptable range for milliseconds[0 - 999].Returns true if within range, otherwise false.

Parameters

  • milliseconds: number

Returns

boolean

public validateMinute(minutes: number): boolean

Validates the number is within an acceptable range for minutes[0 - 59].Returns true if within range, otherwise false.

Parameters

  • minutes: number

Returns

boolean

public validateMonth(month: number): boolean

Validates the number is within an acceptable range for months[0 - 11].

Parameters

  • month: number

Returns

boolean

public validateSecond(second: number): boolean

Validates the number is within an acceptable range for seconds[0 - 59].Returns true if within range, otherwise false.

Parameters

  • second: number

Returns

boolean

public validateYear(year: number): boolean

Validates the number is within an acceptable range for years[0 - 9999].

Parameters

  • year: number

Returns

boolean

public valueOf(): number

Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.

Returns

number