3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
7 YUI.add('datatype-date-parse', function(Y) {
10 * Parse number submodule.
13 * @submodule datatype-date-parse
18 Y.mix(Y.namespace("DataType.Date"), {
20 * Converts data to type Date.
23 * @param data {String | Number} Data to convert. Values supported by the Date constructor are supported.
24 * @return {Date} A Date, or null.
26 parse: function(data) {
30 if(!(LANG.isDate(data))) {
31 date = new Date(data);
38 if(LANG.isDate(date) && (date != "Invalid Date") && !isNaN(date)) { // Workaround for bug 2527965
47 // Add Parsers shortcut
48 Y.namespace("Parsers").date = Y.DataType.Date.parse;