[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/yuilib/3.17.2/datatype-date-parse/ -> datatype-date-parse-debug.js (source)

   1  /*
   2  YUI 3.17.2 (build 9c3c78e)
   3  Copyright 2014 Yahoo! Inc. All rights reserved.
   4  Licensed under the BSD License.
   5  http://yuilibrary.com/license/
   6  */
   7  
   8  YUI.add('datatype-date-parse', function (Y, NAME) {
   9  
  10  /**
  11   * Parse number submodule.
  12   *
  13   * @module datatype-date
  14   * @submodule datatype-date-parse
  15   * @for Date
  16   */
  17  Y.mix(Y.namespace("Date"), {
  18      /**
  19       * Converts data to type Date.
  20       *
  21       * @method parse
  22       * @param data {Date|Number|String} date object, timestamp (string or number), or string parsable by Date.parse
  23       * @return {Date} a Date object or null if unable to parse
  24       */
  25      parse: function(data) {
  26          var val = new Date(+data || data);
  27          if (Y.Lang.isDate(val)) {
  28              return val;
  29          } else {
  30              Y.log("Could not convert data " + Y.dump(val) + " to type Date", "warn", "date");
  31              return null;
  32          }
  33      }
  34  });
  35  
  36  // Add Parsers shortcut
  37  Y.namespace("Parsers").date = Y.Date.parse;
  38  
  39  Y.namespace("DataType");
  40  Y.DataType.Date = Y.Date;
  41  
  42  
  43  }, '3.17.2');


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1