- More work to be done on Timezone, Timezone offsets and DST (Summer Time)
- Add
.getFriendly()to TimeSpan and TimePeriod.
If a date was 3 days and 5 hours away from now, the TimeSpan getFriendly() function would return the following.
var future = new Date().add({days: 3, hours: 5});
var ts = new TimeSpan(future - new Date());
console.log(ts.getFriendly()); // "3 days and 5 hours from now"- More tests!
The following items were at one time tested for inclusion into the library, but were cut. They are documented here for reference.
- Removed
Date.now()because of potential collision with the future ECMA 4 spec, which will include aDate.now()function. - Removed
Date.getDayName(dayOfWeek). Please useDate.CultureInfo.dayNames[dayOfWeek]. - Removed
Date.getMonthName(month). Please useDate.CultureInfo.monthNames[month]. Date.prototype.getQuarter()
/**
* Get the Year Quarter number for the currect date instance.
* @return {Number} 1 to 4
*/
$P.getQuarter = function () {
return Math.ceil((this.getMonth() + 1)/3);
}; Date.isDate(), Please useinstanceof.
var d1 = null;
d1 = Date.today();
console.log(d1 instanceof Date);/**
* Determines if an object is a Date object.
* @return {Boolean} true if object is a Date, otherwise false.
*/
$D.isDate = function (obj) {
return (obj instanceof Date);
};Another Version...
/**
* Determines if an object is a Date object.
* @return {Boolean} true if object is a Date, otherwise false.
*/
$D.isDate = function (obj) {
return (obj !== null) ? obj.constructor.toString().match(/Date/i) == "Date" : false;
};