Alien-Web-ExtJS-V3

 view release on metacpan or  search on metacpan

share/docs/source/Date.html  view on Meta::CPAN

        Z: "(this.getTimezoneOffset() * -60)",

        c: function() { // ISO-8601 -- GMT format
            for (var c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
                var e = c.charAt(i);
                code.push(e == "T" ? "'T'" : Date.getFormatCode(e)); // treat T as a character literal
            }
            return code.join(" + ");
        },
        /*
        c: function() { // ISO-8601 -- UTC format
            return [
              "this.getUTCFullYear()", "'-'",
              "String.leftPad(this.getUTCMonth() + 1, 2, '0')", "'-'",
              "String.leftPad(this.getUTCDate(), 2, '0')",
              "'T'",
              "String.leftPad(this.getUTCHours(), 2, '0')", "':'",
              "String.leftPad(this.getUTCMinutes(), 2, '0')", "':'",
              "String.leftPad(this.getUTCSeconds(), 2, '0')",
              "'Z'"
            ].join(" + ");
        },
        */

        U: "Math.round(this.getTime() / 1000)"
    },

<span id='Date-static-method-isValid'>    /**
</span>     * Checks if the passed Date parameters will cause a javascript Date &quot;rollover&quot;.
     * @param {Number} year 4-digit year
     * @param {Number} month 1-based month-of-year
     * @param {Number} day Day of month
     * @param {Number} hour (optional) Hour
     * @param {Number} minute (optional) Minute
     * @param {Number} second (optional) Second
     * @param {Number} millisecond (optional) Millisecond
     * @return {Boolean} true if the passed parameters do not cause a Date &quot;rollover&quot;, false otherwise.
     * @static
     */
    isValid : function(y, m, d, h, i, s, ms) {
        // setup defaults
        h = h || 0;
        i = i || 0;
        s = s || 0;
        ms = ms || 0;

        // Special handling for year &lt; 100
        var dt = new Date(y &lt; 100 ? 100 : y, m - 1, d, h, i, s, ms).add(Date.YEAR, y &lt; 100 ? y - 100 : 0);

        return y == dt.getFullYear() &amp;&amp;
            m == dt.getMonth() + 1 &amp;&amp;
            d == dt.getDate() &amp;&amp;
            h == dt.getHours() &amp;&amp;
            i == dt.getMinutes() &amp;&amp;
            s == dt.getSeconds() &amp;&amp;
            ms == dt.getMilliseconds();
    },

<span id='Date-static-method-parseDate'>    /**
</span>     * Parses the passed string using the specified date format.
     * Note that this function expects normal calendar dates, meaning that months are 1-based (i.e. 1 = January).
     * The {@link #defaults} hash will be used for any date value (i.e. year, month, day, hour, minute, second or millisecond)
     * which cannot be found in the passed string. If a corresponding default date value has not been specified in the {@link #defaults} hash,
     * the current date's year, month, day or DST-adjusted zero-hour time value will be used instead.
     * Keep in mind that the input date string must precisely match the specified format string
     * in order for the parse operation to be successful (failed parse operations return a null value).
     * &lt;p&gt;Example:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
//dt = Fri May 25 2007 (current date)
var dt = new Date();

//dt = Thu May 25 2006 (today&amp;#39;s month/day in 2006)
dt = Date.parseDate(&quot;2006&quot;, &quot;Y&quot;);

//dt = Sun Jan 15 2006 (all date parts specified)
dt = Date.parseDate(&quot;2006-01-15&quot;, &quot;Y-m-d&quot;);

//dt = Sun Jan 15 2006 15:20:01
dt = Date.parseDate(&quot;2006-01-15 3:20:01 PM&quot;, &quot;Y-m-d g:i:s A&quot;);

// attempt to parse Sun Feb 29 2006 03:20:01 in strict mode
dt = Date.parseDate(&quot;2006-02-29 03:20:01&quot;, &quot;Y-m-d H:i:s&quot;, true); // returns null
&lt;/code&gt;&lt;/pre&gt;
     * @param {String} input The raw date string.
     * @param {String} format The expected date string format.
     * @param {Boolean} strict (optional) True to validate date strings while parsing (i.e. prevents javascript Date &quot;rollover&quot;)
                        (defaults to false). Invalid date strings will return null when parsed.
     * @return {Date} The parsed Date.
     * @static
     */
    parseDate : function(input, format, strict) {
        var p = Date.parseFunctions;
        if (p[format] == null) {
            Date.createParser(format);
        }
        return p[format](input, Ext.isDefined(strict) ? strict : Date.useStrict);
    },

    // private
    getFormatCode : function(character) {
        var f = Date.formatCodes[character];

        if (f) {
          f = typeof f == 'function'? f() : f;
          Date.formatCodes[character] = f; // reassign function result to prevent repeated execution
        }

        // note: unknown characters are treated as literals
        return f || (&quot;'&quot; + String.escape(character) + &quot;'&quot;);
    },

    // private
    createFormat : function(format) {
        var code = [],
            special = false,
            ch = '';

        for (var i = 0; i &lt; format.length; ++i) {
            ch = format.charAt(i);
            if (!special &amp;&amp; ch == &quot;\\&quot;) {
                special = true;
            } else if (special) {



( run in 1.541 second using v1.01-cache-2.11-cpan-b50b6a40fd4 )