Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 64 lines (44 sloc) 1.899 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
TODO
-------------------
1. More work to be done on Timezone, Timezone offsets and DST (Summer Time)

2. Add .getFriendly() to TimeSpan and TimePeriod. Example

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"

3. More tests!



CUTTING ROOM FLOOR
-------------------

The following items were at one time tested for inclusion into the library, but were cut.
They are documented here for reference.

1. Removed <static> Date.now() because of potential collision with the future ECMA 4 spec, which will include a Date.now() function.

2. Removed <static> Date.getDayName(dayOfWeek). Please use Date.CultureInfo.dayNames[dayOfWeek].

3. Removed <static> Date.getMonthName(month). Please use Date.CultureInfo.monthNames[month].

2. 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);
    };

3. Date.isDate(). Please use "instanceof".

Example

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;
    };
Something went wrong with that request. Please try again.