Interface IDateJS

DateJS Public Instance Methods

Hierarchy

  • Date
    • IDateJS

Index

Methods

Methods

public add(config?: IDateJSLiteral): IDateJS

Adds(or subtracts) to the value of the year, month, day, hour, minute, second, millisecond of the date instance using given configuration object. Positive and Negative values allowed.

Parameters

Returns

IDateJS

public addDays(days: number): IDateJS

Adds the specified number of days to this instance.The number can be positive or negative.

Parameters

  • days: number

Returns

IDateJS

public addHours(hours: number): IDateJS

Adds the specified number of hours to this instance given the number of hours to add.The number can be positive or negative.

Parameters

  • hours: number

Returns

IDateJS

public addMilliseconds(milliseconds: number): IDateJS

Adds the specified number of milliseconds to this instance.

Parameters

  • milliseconds: number

Returns

IDateJS

public addMinutes(minutes: number): IDateJS

Adds the specified number of minutes to this instance given the number of minutes to add.The number can be positive or negative.

Parameters

  • minutes: number

Returns

IDateJS

public addMonths(months: number): IDateJS

Adds the specified number of months to this instance given the number of months to add.The number can be positive or negative.

Parameters

  • months: number

Returns

IDateJS

public addSeconds(seconds: number): IDateJS

Adds the specified number of seconds to this instance given the number of seconds to add.The number can be positive or negative.

Parameters

  • seconds: number

Returns

IDateJS

public addWeeks(weeks: number): IDateJS

Adds the specified number of weeks to this instance given the number of weeks to add.The number can be positive or negative.

Parameters

  • weeks: number

Returns

IDateJS

public addYears(years: number): IDateJS

Adds the specified number of years to this instance given the number of years to add.The number can be positive or negative.

Parameters

  • years: number

Returns

IDateJS

public between(startDate: IDateJS, endDate: IDateJS): boolean

Determines if this instance is between a range of two dates or equal to either the start or end dates.

Parameters

Returns

boolean

public clearTime(): IDateJS

Resets the time of this Date object to 12:00 AM(00:00), which is the start of the day.

Returns

IDateJS

public clone(): IDateJS

Returns a new Date object that is an exact date and time copy of the original instance.

Returns

IDateJS

public compareTo(date: IDateJS): number

Compares this instance to a Date object 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(date: IDateJS): boolean

Compares this instance to another Date object and returns true if they are equal, otherwise false.

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 getElapsed(date: IDateJS): number

Returns the number of milliseconds between this date and date.

Parameters

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 getISOWeek(): string

Get the ISO 8601 week number. Week one ("01") is the week which contains the first Thursday of the year. Monday is considered the first day of the week.

Returns

string

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 getOrdinalNumber(): number

Get the Ordinal day (numeric day number) of the year, adjusted for leap year. Returns 1 through 365 (366 in leap years)

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 getTimezone(): string

Get the timezone abbreviation of the current date.

Returns

string

public getTimezoneOffset(): number

Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).

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 getUTCOffset(): string

Get the offset from UTC of the current date. Returns the 4-character offset string prefixed with + or - (e.g. "-0500").

Returns

string

public getUTCSeconds(): number

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

Returns

number

public getWeek(): number

Get the week number. Week one (1) is the week which contains the first Thursday of the year. Monday is considered the first day of the week.

Returns

number

public hasDaylightSavingTime(): boolean

Indicates whether Daylight Saving Time is observed in the current time zone.

Returns

boolean

public isAfter(date: IDateJS): boolean

Determines if this date occurs after the date to compare to.

Parameters

Returns

boolean

public isBefore(date: IDateJS): boolean

Determines if this date occurs before the date to compare to.

Parameters

Returns

boolean

public isDaylightSavingTime(): boolean

Indicates whether this Date instance is within the Daylight Saving Time range for the current time zone.

Returns

boolean

public isToday(date: IDateJS): boolean

Determines if the current Date instance occurs on the same Date as the supplied 'date'.

Parameters

Returns

boolean

public moveToDayOfWeek(dayOfWeek: number, direction: number): IDateJS

Move to the next or previous dayOfWeek. Whether to move into the future (+1) or past(-1) is controlled by the optional direction parameter.

Parameters

  • dayOfWeek: number
  • direction: number

Returns

IDateJS

public moveToFirstDayOfMonth(): IDateJS

Moves the date to the first day of the month.

Returns

IDateJS

public moveToLastDayOfMonth(): IDateJS

Moves the date to the last day of the month.

Returns

IDateJS

public moveToMonth(month: number, direction: number): IDateJS

Move to the next or previous month.Whether to move into the future(+1) or past(-1) is controlled by the optional direction parameter.

Parameters

  • month: number
  • direction: number

Returns

IDateJS

public moveToNthOccurrence(dayOfWeek: number, occurrence: number): IDateJS

Moves the date to the next nth occurrence of the dayOfWeek starting from the beginning of the month. The number (-1) is a magic number and will return the last occurrence of the dayOfWeek in the month.

Parameters

  • dayOfWeek: number
  • occurrence: number

Returns

IDateJS

public set(config: IDateJSLiteral): IDateJS

Set the value of year, month, day, hour, minute, second, millisecond of date instance using given configuration object.

Parameters

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 setTimeToNow(): IDateJS

Resets the time of this Date object to the current time('now').

Returns

IDateJS

public setTimezone(timezoneAbbreviation: string): IDateJS

Set the timezone for the current date using a culture - specific timezone abbreviation("PST").Note that in most JavaScript implementations, this will appear to change the time since the timezone is always based on the locale.

Parameters

  • timezoneAbbreviation: string

Returns

IDateJS

public setTimezoneOffset(timezoneOffset: number): IDateJS

Set the timezone for the current date using an offset(-0700).Note that in most JavaScript implementations, this will appear to change the time since the timezone is always based on the locale.

Parameters

  • timezoneOffset: number

Returns

IDateJS

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 setWeek(week: number): IDateJS

Moves the date to Monday of the week set. Week one (1) is the week which contains the first Thursday of the year.

Parameters

  • week: number

Returns

IDateJS

public toDateString(): string

Returns a date as a string value.

Returns

string

public toISOString(): string

Converts the current date instance into a string with an ISO 8601 format.The date is converted to it's UTC value. As per the ISO 8601 specification, the string will be wrapped with double quotation marks (").

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(format?: string): string

Converts the value of the current Date object to its equivalent string representation.Use format argument to specify format(optional).See FormatSpecifiers for more info.

Parameters

  • format?: string optional

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 valueOf(): number

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

Returns

number