File Coverage

lib/Amon2/Setup/Asset/StrftimeJS.pm
Criterion Covered Total %
statement 7 8 87.5
branch n/a
condition n/a
subroutine 3 4 75.0
pod 0 2 0.0
total 10 14 71.4


line stmt bran cond sub pod time code
1             # This file is generated by author/assets.pl. Do not edit manually.
2             use strict;
3 1     1   352 use warnings;
  1         2  
  1         28  
4 1     1   5  
  1         2  
  1         168  
5             <<',,,';
6             <script src="<: uri_for('/static/js/strftime.js') :>"></script>
7 1     1 0 5 ,,,
8             }
9              
10             return {
11             'js/strftime.js' => "// version 0.11 by Daniel Rench
12             // More information: http://dren.ch/strftime/
13             // This is public domain software
14 0     0 0   //
15             // Some modification by tokuhirom.
16             // Tokuhirom's modifications are public domain, too.
17             (function () {
18             \"use strict\";
19              
20             function pad (d, n, p) {
21             var s = '' + d;
22             p = p || '0';
23             while (s.length < n) s = p + s;
24             return s;
25             }
26              
27             var locales = {
28             en: {
29             A: [
30             'Sunday', 'Monday', 'Tuesday', 'Wednesday',
31             'Thursday', 'Friday', 'Saturday'
32             ],
33             a: [
34             \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"
35             ],
36             B: [
37             'January', 'February', 'March', 'April', 'May', 'June', 'July',
38             'August', 'September', 'October', 'November', 'December'
39             ],
40             b: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]
41             },
42             ja: {
43             B: [\" 1\x{6708}\", \" 2\x{6708}\", \" 3\x{6708}\", \" 4\x{6708}\", \" 5\x{6708}\", \" 6\x{6708}\", \" 7\x{6708}\", \" 8\x{6708}\", \" 9\x{6708}\", \"10\x{6708}\", \"11\x{6708}\", \"12\x{6708}\"],
44             b: [\" 1\x{6708}\", \" 2\x{6708}\", \" 3\x{6708}\", \" 4\x{6708}\", \" 5\x{6708}\", \" 6\x{6708}\", \" 7\x{6708}\", \" 8\x{6708}\", \" 9\x{6708}\", \"10\x{6708}\", \"11\x{6708}\", \"12\x{6708}\"],
45             A: [\"\x{65e5}\x{66dc}\x{65e5}\", \"\x{6708}\x{66dc}\x{65e5}\", \"\x{706b}\x{66dc}\x{65e5}\", \"\x{6c34}\x{66dc}\x{65e5}\", \"\x{6728}\x{66dc}\x{65e5}\", \"\x{91d1}\x{66dc}\x{65e5}\", \"\x{571f}\x{66dc}\x{65e5}\"],
46             a: [\"\x{65e5}\", \"\x{6708}\", \"\x{706b}\", \"\x{6c34}\", \"\x{6728}\", \"\x{91d1}\", \"\x{571f}\"]
47             }
48             };
49              
50             var formats = {
51             A: function (d, locale) { return locales[locale].A[d.getDay()]; },
52             a: function (d, locale) { return locales[locale].a[d.getDay()]; },
53             B: function (d, locale) { return locales[locale].B[d.getMonth()]; },
54             b: function (d, locale) { return locales[locale].b[d.getMonth()]; },
55             C: function (d) { return Math.floor(d.getFullYear()/100); },
56             c: function (d) { return d.toString(); },
57             D: function (d) {
58             return formats.m(d) + '/' +
59             formats.d(d) + '/' + formats.y(d);
60             },
61             d: function (d) { return pad(d.getDate(), 2,'0'); },
62             e: function (d) { return pad(d.getDate(), 2,' '); },
63             F: function (d) {
64             return formats.Y(d) + '-' + formats.m(d) + '-' +
65             formats.d(d);
66             },
67             H: function (d) { return pad(d.getHours(), 2,'0'); },
68             I: function (d) { return pad((d.getHours() % 12 || 12), 2); },
69             /*
70             %g
71             like %G, but without the century
72             %G
73             The 4-digit year corresponding to the ISO week number
74             %j
75             day of the year as a decimal number (range 001 to 366)
76             %U
77             week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
78             %V
79             The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
80             %W
81             week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
82             %Z
83             time zone name or abbreviation
84              
85             j: function (d) {
86             var t = d.getDate();
87             var m = d.getMonth() - 1;
88             if (m > 1) {
89             var y = d.getYear();
90             if (((y % 100) == 0) && ((y % 400) == 0)) ++t;
91             else if ((y % 4) == 0) ++t;
92             }
93             while (m > -1) t += d.dpm[m--];
94             return t.pad(3,'0');
95             },
96             */
97             k: function (d) { return pad(d.getHours(), 2,' '); },
98             l: function (d) { return pad((d.getHours() % 12 || 12), 2,' '); },
99             M: function (d) { return pad(d.getMinutes(), 2,'0'); },
100             m: function (d) { return pad((d.getMonth()+1), 2,'0'); },
101             n: function (d) { return \"\\n\"; },
102             p: function (d) { return (d.getHours() > 11) ? 'PM' : 'AM'; },
103             P: function (d) { return formats.p(d).toLowerCase(); },
104             R: function (d) { return formats.H(d) + ':' + formats.M(d); },
105             r: function (d) {
106             return formats.I(d) + ':' + formats.M(d) + ':' +
107             formats.S(d) + ' ' + formats.p(d);
108             },
109             S: function (d) { return pad(d.getSeconds(), 2,'0'); },
110             s: function (d) { return Math.floor(d.getTime()/1000); },
111             T: function (d) {
112             return formats.H(d) + ':' + formats.M(d) + ':' +
113             formats.S(d);
114             },
115             t: function (d) { return \"\\t\"; },
116             /* U: function (d) { return false; }, */
117             u: function (d) { return(d.getDay() || 7); },
118             /* V: function (d) { return false; }, */
119             v: function (d) {
120             return formats.e(d) + '-' + formats.b(d) + '-' +
121             formats.Y(d);
122             },
123             /* W: function (d) { return false; }, */
124             w: function (d) { return d.getDay(); },
125             X: function (d) { return d.toTimeString(); }, // wrong?
126             x: function (d) { return d.toDateString(); }, // wrong?
127             Y: function (d) { return d.getFullYear(); },
128             y: function (d) { return pad((d.getYear() % 100), 2); },
129             // Z: function (d) { return d.toString().match(/\\((.+)\\)\$/)[1]; },
130             // z: function (d) { return d.getTimezoneOffset(); }, // wrong
131             // z: function (d) { return d.toString().match(/\\sGMT([+-]\\d+)/)[1]; },
132             '%': function (d) { return '%'; }
133             };
134              
135             formats['+'] = formats.c;
136             formats.h = formats.b;
137              
138             var defaultLocale = 'en';
139              
140             function strftime(date, fmt, locale) {
141             var r = '';
142             var n = 0;
143             if (!locale) { locale = defaultLocale; }
144             while(n < fmt.length) {
145             var c = fmt.substring(n, n+1);
146             if (c == '%') {
147             c = fmt.substring(++n, n+1);
148             r += (formats[c]) ? formats[c](date, locale) : c;
149             } else r += c;
150             ++n;
151             }
152             return r;
153             }
154              
155             Date.prototype.strftime = function (fmt, locale) {
156             return strftime(this, fmt, locale);
157             };
158              
159             Date.prototype.strftime.formats = formats;
160             Date.prototype.strftime.setDefaultLocale = function (locale) {
161             defaultLocale = locale;
162             };
163             Date.prototype.strftime.locales = locales;
164              
165             })();
166             "
167             }
168             ;
169             }
170              
171             1;