Class $k.Date
Represents a date
- Defined in: Date.js
Constructor Attributes | Constructor Name and Description |
---|---|
$k.Date(value, month, day)
Constructs a Date from the argument(s), which can be a Date object, undefined, or component values.
|
Method Summary
Class Detail
$k.Date(value, month, day)
Constructs a Date from the argument(s), which can be a Date object, undefined, or component values.
If undefined, the current date is returned
- Parameters:
- value Optional
- Date or year
- month Optional
- Month number
- day Optional
- Day number
Method Detail
-
{boolean} equals(value)Returns true if the values are equal
- Parameters:
- value
- Returns:
- {boolean}
-
{number} getDayNumber()Returns the number of the day, e.g. 18 for 2011-03-18
- Returns:
- {number}
-
{number} getMonthNumber()Returns the number of the month. Unlike Date.prototype.month(), this is not the 0-based month index, so for January getMonthNumber() returns 1, not 0
- Returns:
- {number}
-
{number} getYear()Returns the full year
- Returns:
- {number}
-
Returns the latest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T23:59:59.999 for the date 2007-03-01. Assumes that this is date/time of the local timezone
- Returns:
- {$k.Date}
-
Returns the latest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T23:59:59.999 for the date 2007-03-01. Assumes that this is date/time of the local timezone
- Returns:
- {$k.Date}
-
Returns the earliest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T0:00:00.0 for the date 2007-03-01. Assumes that this is date/time of the local timezone
- Returns:
- {$k.Date}
-
Returns the earliest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T0:00:00.0 for the date 2007-03-01. Assumes that this is an UTC date/time
- Returns:
- {$k.Date}
-
<static> $k.Date.parse(string, language)Parse the date/time string. Both ISO 8601 adnd localized strings are supported.
- Parameters:
- {string} string
- The string representation
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- The parsed date/time
-
setDayNumber(day)Sets the number of the day, e.g. 23 for 2012-05-23
- Parameters:
- {number} day
-
setMonthNumber(month)Set the number of the month. Unlike Date.prototype.month(), this is not the 0-based month index, so for January pass 1 to setMonthNumber() , not 0.
- Parameters:
- {number} month
-
setYear(year)Sets the full year. The year is not modified, so setYear(99) sets the year 99, not 1999.
- Parameters:
- {number} year
-
toDate()Returns the date/time as a Javascript date object. Assumes that this is date/time of the local timezone
-
toJSON(key)Returns a string representing the date/time, similar to Date.prototype.toJSON ( key )
- Parameters:
- key
- See:
- $k.Date#toJSON
-
{string} toString(language)Returns the string representation. Equivalent to valueString()
- Parameters:
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- {string}
-
{string} valueString(language)Returns the string representation
- Parameters:
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- {string}