~ubuntu-branches/ubuntu/precise/maas/precise-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/datatype-date-parse/datatype-date-parse.js

Tags: 1.2+bzr1373+dfsg-0ubuntu1~12.04.4
* SECURITY UPDATE: failure to authenticate downloaded content (LP: #1039513)
  - debian/patches/CVE-2013-1058.patch: Authenticate downloaded files with
    GnuPG and MD5SUM files. Thanks to Julian Edwards.
  - CVE-2013-1058
* SECURITY UPDATE: configuration options may be loaded from current working
  directory (LP: #1158425)
  - debian/patches/CVE-2013-1057-1-2.patch: Do not load configuration
    options from the current working directory. Thanks to Julian Edwards.
  - CVE-2013-1057

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('datatype-date-parse', function(Y) {
8
 
 
9
 
/**
10
 
 * Parse number submodule.
11
 
 *
12
 
 * @module datatype
13
 
 * @submodule datatype-date-parse
14
 
 * @for DataType.Date
15
 
 */
16
 
var LANG = Y.Lang;
17
 
 
18
 
Y.mix(Y.namespace("DataType.Date"), {
19
 
    /**
20
 
     * Converts data to type Date.
21
 
     *
22
 
     * @method parse
23
 
     * @param data {String | Number} Data to convert. Values supported by the Date constructor are supported.
24
 
     * @return {Date} A Date, or null.
25
 
     */
26
 
    parse: function(data) {
27
 
        var date = null;
28
 
 
29
 
        //Convert to date
30
 
        if(!(LANG.isDate(data))) {
31
 
            date = new Date(data);
32
 
        }
33
 
        else {
34
 
            return date;
35
 
        }
36
 
 
37
 
        // Validate
38
 
        if(LANG.isDate(date) && (date != "Invalid Date") && !isNaN(date)) { // Workaround for bug 2527965
39
 
            return date;
40
 
        }
41
 
        else {
42
 
            return null;
43
 
        }
44
 
    }
45
 
});
46
 
 
47
 
// Add Parsers shortcut
48
 
Y.namespace("Parsers").date = Y.DataType.Date.parse;
49
 
 
50
 
 
51
 
}, '3.4.1' );