Date
Represents an instant capturing the date, but not the time, nor the timezone.
Created Date objects are frozen with Object.freeze()
in constructor and thus immutable.
Static Method Summary
Static Public Methods | ||
public static |
fromStandardDate(standardDate: global.Date): Date Create a Date object from the given standard JavaScript |
Constructor Summary
Public Constructor | ||
public |
constructor(year: NumberOrInteger, month: NumberOrInteger, day: NumberOrInteger) |
Member Summary
Public Members | ||
public |
day: NumberOrInteger The day. |
|
public |
month: NumberOrInteger The month. |
|
public |
year: NumberOrInteger The year. |
Method Summary
Public Methods | ||
public |
toStandardDate(): StandardDate Convert date to standard JavaScript |
Static Public Methods
public static fromStandardDate(standardDate: global.Date): Date source
Create a Date object from the given standard JavaScript Date
.
Hour, minute, second, millisecond and time zone offset components of the given date are ignored.
NOTE: the function toStandardDate and fromStandardDate are not inverses of one another. fromStandardDate takes the Day, Month and Year in local time from the supplies JavaScript Date object, while toStandardDate creates a new JavaScript Date object at midnight UTC. This incongruity will be rectified in 6.0 If your timezone has a negative offset from UTC, creating a JavaScript Date at midnight UTC and converting it with fromStandardDate will result in a Date for the day before.
Params:
Name | Type | Attribute | Description |
standardDate | global.Date | The standard JavaScript date to convert. |
Public Constructors
public constructor(year: NumberOrInteger, month: NumberOrInteger, day: NumberOrInteger) source
Params:
Name | Type | Attribute | Description |
year | NumberOrInteger | The year for the new local date. |
|
month | NumberOrInteger | The month for the new local date. |
|
day | NumberOrInteger | The day for the new local date. |
Public Members
Public Methods
public toStandardDate(): StandardDate source
Convert date to standard JavaScript Date
.
The time component of the returned Date
is set to midnight
and the time zone is set to UTC.
NOTE: the function toStandardDate and fromStandardDate are not inverses of one another. fromStandardDate takes the Day, Month and Year in local time from the supplies JavaScript Date object, while toStandardDate creates a new JavaScript Date object at midnight UTC. This incongruity will be rectified in 6.0
Return:
StandardDate | Standard JavaScript |