date-and-time
Advanced tools
Comparing version 0.8.1 to 0.9.0
@@ -8,103 +8,129 @@ /** | ||
var date = {}, | ||
locales = {}, | ||
plugins = {}, | ||
lang = 'en', | ||
locales = { | ||
en: { | ||
MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], | ||
ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], | ||
A: ['a.m.', 'p.m.'], | ||
formatter: { | ||
YYYY: function (d/*, formatString*/) { return ('000' + d.getFullYear()).slice(-4); }, | ||
YY: function (d/*, formatString*/) { return ('0' + d.getFullYear()).slice(-2); }, | ||
Y: function (d/*, formatString*/) { return '' + d.getFullYear(); }, | ||
MMMM: function (d/*, formatString*/) { return this.MMMM[d.getMonth()]; }, | ||
MMM: function (d/*, formatString*/) { return this.MMM[d.getMonth()]; }, | ||
MM: function (d/*, formatString*/) { return ('0' + (d.getMonth() + 1)).slice(-2); }, | ||
M: function (d/*, formatString*/) { return '' + (d.getMonth() + 1); }, | ||
DD: function (d/*, formatString*/) { return ('0' + d.getDate()).slice(-2); }, | ||
D: function (d/*, formatString*/) { return '' + d.getDate(); }, | ||
HH: function (d/*, formatString*/) { return ('0' + d.getHours()).slice(-2); }, | ||
H: function (d/*, formatString*/) { return '' + d.getHours(); }, | ||
A: function (d/*, formatString*/) { return this.A[d.getHours() > 11 | 0]; }, | ||
hh: function (d/*, formatString*/) { return ('0' + (d.getHours() % 12 || 12)).slice(-2); }, | ||
h: function (d/*, formatString*/) { return '' + (d.getHours() % 12 || 12); }, | ||
mm: function (d/*, formatString*/) { return ('0' + d.getMinutes()).slice(-2); }, | ||
m: function (d/*, formatString*/) { return '' + d.getMinutes(); }, | ||
ss: function (d/*, formatString*/) { return ('0' + d.getSeconds()).slice(-2); }, | ||
s: function (d/*, formatString*/) { return '' + d.getSeconds(); }, | ||
SSS: function (d/*, formatString*/) { return ('00' + d.getMilliseconds()).slice(-3); }, | ||
SS: function (d/*, formatString*/) { return ('0' + (d.getMilliseconds() / 10 | 0)).slice(-2); }, | ||
S: function (d/*, formatString*/) { return '' + (d.getMilliseconds() / 100 | 0); }, | ||
dddd: function (d/*, formatString*/) { return this.dddd[d.getDay()]; }, | ||
ddd: function (d/*, formatString*/) { return this.ddd[d.getDay()]; }, | ||
dd: function (d/*, formatString*/) { return this.dd[d.getDay()]; }, | ||
Z: function (d/*, formatString*/) { | ||
var offset = d.utc ? 0 : d.getTimezoneOffset() / 0.6; | ||
return (offset > 0 ? '-' : '+') + ('000' + Math.abs(offset - offset % 100 * 0.4)).slice(-4); | ||
}, | ||
post: function (str) { return str; } | ||
_res = { | ||
MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], | ||
ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], | ||
A: ['a.m.', 'p.m.'] | ||
}, | ||
_formatter = { | ||
YYYY: function (d/*, formatString*/) { return ('000' + d.getFullYear()).slice(-4); }, | ||
YY: function (d/*, formatString*/) { return ('0' + d.getFullYear()).slice(-2); }, | ||
Y: function (d/*, formatString*/) { return '' + d.getFullYear(); }, | ||
MMMM: function (d/*, formatString*/) { return this.res.MMMM[d.getMonth()]; }, | ||
MMM: function (d/*, formatString*/) { return this.res.MMM[d.getMonth()]; }, | ||
MM: function (d/*, formatString*/) { return ('0' + (d.getMonth() + 1)).slice(-2); }, | ||
M: function (d/*, formatString*/) { return '' + (d.getMonth() + 1); }, | ||
DD: function (d/*, formatString*/) { return ('0' + d.getDate()).slice(-2); }, | ||
D: function (d/*, formatString*/) { return '' + d.getDate(); }, | ||
HH: function (d/*, formatString*/) { return ('0' + d.getHours()).slice(-2); }, | ||
H: function (d/*, formatString*/) { return '' + d.getHours(); }, | ||
A: function (d/*, formatString*/) { return this.res.A[d.getHours() > 11 | 0]; }, | ||
hh: function (d/*, formatString*/) { return ('0' + (d.getHours() % 12 || 12)).slice(-2); }, | ||
h: function (d/*, formatString*/) { return '' + (d.getHours() % 12 || 12); }, | ||
mm: function (d/*, formatString*/) { return ('0' + d.getMinutes()).slice(-2); }, | ||
m: function (d/*, formatString*/) { return '' + d.getMinutes(); }, | ||
ss: function (d/*, formatString*/) { return ('0' + d.getSeconds()).slice(-2); }, | ||
s: function (d/*, formatString*/) { return '' + d.getSeconds(); }, | ||
SSS: function (d/*, formatString*/) { return ('00' + d.getMilliseconds()).slice(-3); }, | ||
SS: function (d/*, formatString*/) { return ('0' + (d.getMilliseconds() / 10 | 0)).slice(-2); }, | ||
S: function (d/*, formatString*/) { return '' + (d.getMilliseconds() / 100 | 0); }, | ||
dddd: function (d/*, formatString*/) { return this.res.dddd[d.getDay()]; }, | ||
ddd: function (d/*, formatString*/) { return this.res.ddd[d.getDay()]; }, | ||
dd: function (d/*, formatString*/) { return this.res.dd[d.getDay()]; }, | ||
Z: function (d/*, formatString*/) { | ||
var offset = d.utc ? 0 : d.getTimezoneOffset() / 0.6; | ||
return (offset > 0 ? '-' : '+') + ('000' + Math.abs(offset - offset % 100 * 0.4)).slice(-4); | ||
}, | ||
post: function (str) { return str; } | ||
}, | ||
_parser = { | ||
YYYY: function (str/*, formatString */) { return this.exec(/^\d{1,4}/, str); }, | ||
YY: function (str/*, formatString */) { | ||
var result = this.exec(/^\d\d?/, str); | ||
result.value += result.value < 70 ? 2000 : result.value < 100 ? 1900 : 0; | ||
return result; | ||
}, | ||
MMMM: function (str/*, formatString */) { | ||
var result = this.find(this.res.MMMM, str); | ||
result.value++; | ||
return result; | ||
}, | ||
MMM: function (str/*, formatString */) { | ||
var result = this.find(this.res.MMM, str); | ||
result.value++; | ||
return result; | ||
}, | ||
MM: function (str/*, formatString */) { return this.exec(/^\d\d/, str); }, | ||
M: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); }, | ||
DD: function (str/*, formatString */) { return this.exec(/^\d\d/, str); }, | ||
D: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); }, | ||
HH: function (str/*, formatString */) { return this.exec(/^\d\d/, str); }, | ||
H: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); }, | ||
A: function (str/*, formatString */) { return this.find(this.res.A, str); }, | ||
hh: function (str/*, formatString */) { return this.exec(/^\d\d/, str); }, | ||
h: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); }, | ||
mm: function (str/*, formatString */) { return this.exec(/^\d\d/, str); }, | ||
m: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); }, | ||
ss: function (str/*, formatString */) { return this.exec(/^\d\d/, str); }, | ||
s: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); }, | ||
SSS: function (str/*, formatString */) { return this.exec(/^\d{1,3}/, str); }, | ||
SS: function (str/*, formatString */) { | ||
var result = this.exec(/^\d\d?/, str); | ||
result.value *= 10; | ||
return result; | ||
}, | ||
S: function (str/*, formatString */) { | ||
var result = this.exec(/^\d/, str); | ||
result.value *= 100; | ||
return result; | ||
}, | ||
h12: function (h, a) { return (h === 12 ? 0 : h) + a * 12; }, | ||
exec: function (re, str) { | ||
var result = (re.exec(str) || [''])[0]; | ||
return { value: result | 0, length: result.length }; | ||
}, | ||
find: function (array, str) { | ||
var index = -1, length = 0; | ||
for (var i = 0, len = array.length, item; i < len; i++) { | ||
item = array[i]; | ||
if (!str.indexOf(item) && item.length > length) { | ||
index = i; | ||
length = item.length; | ||
} | ||
} | ||
return { value: index, length: length }; | ||
}, | ||
pre: function (str) { return str; } | ||
}, | ||
customize = function (code, base, locale) { | ||
var extend = function (proto, props, res) { | ||
var Locale = function (r) { | ||
if (r) { this.res = r; } | ||
}; | ||
Locale.prototype = proto; | ||
Locale.prototype.constructor = Locale; | ||
var newLocale = new Locale(res), | ||
value; | ||
for (var key in props || {}) { | ||
if (props.hasOwnProperty(key)) { | ||
value = props[key]; | ||
newLocale[key] = value.slice ? value.slice() : value; | ||
} | ||
} | ||
return newLocale; | ||
}, | ||
parser: { | ||
YYYY: function (str/*, formatString */) { return this.parser.exec(/^\d{1,4}/, str); }, | ||
YY: function (str/*, formatString */) { | ||
var result = this.parser.exec(/^\d\d?/, str); | ||
result.value += result.value < 70 ? 2000 : result.value < 100 ? 1900 : 0; | ||
return result; | ||
}, | ||
MMMM: function (str/*, formatString */) { | ||
var result = this.parser.find(this.MMMM, str); | ||
result.value++; | ||
return result; | ||
}, | ||
MMM: function (str/*, formatString */) { | ||
var result = this.parser.find(this.MMM, str); | ||
result.value++; | ||
return result; | ||
}, | ||
MM: function (str/*, formatString */) { return this.parser.exec(/^\d\d/, str); }, | ||
M: function (str/*, formatString */) { return this.parser.exec(/^\d\d?/, str); }, | ||
DD: function (str/*, formatString */) { return this.parser.exec(/^\d\d/, str); }, | ||
D: function (str/*, formatString */) { return this.parser.exec(/^\d\d?/, str); }, | ||
HH: function (str/*, formatString */) { return this.parser.exec(/^\d\d/, str); }, | ||
H: function (str/*, formatString */) { return this.parser.exec(/^\d\d?/, str); }, | ||
A: function (str/*, formatString */) { return this.parser.find(this.A, str); }, | ||
hh: function (str/*, formatString */) { return this.parser.exec(/^\d\d/, str); }, | ||
h: function (str/*, formatString */) { return this.parser.exec(/^\d\d?/, str); }, | ||
mm: function (str/*, formatString */) { return this.parser.exec(/^\d\d/, str); }, | ||
m: function (str/*, formatString */) { return this.parser.exec(/^\d\d?/, str); }, | ||
ss: function (str/*, formatString */) { return this.parser.exec(/^\d\d/, str); }, | ||
s: function (str/*, formatString */) { return this.parser.exec(/^\d\d?/, str); }, | ||
SSS: function (str/*, formatString */) { return this.parser.exec(/^\d{1,3}/, str); }, | ||
SS: function (str/*, formatString */) { | ||
var result = this.parser.exec(/^\d\d?/, str); | ||
result.value *= 10; | ||
return result; | ||
}, | ||
S: function (str/*, formatString */) { | ||
var result = this.parser.exec(/^\d/, str); | ||
result.value *= 100; | ||
return result; | ||
}, | ||
h12: function (h, a) { return (h === 12 ? 0 : h) + a * 12; }, | ||
exec: function (re, str) { | ||
var result = (re.exec(str) || [''])[0]; | ||
return { value: result | 0, length: result.length }; | ||
}, | ||
find: function (array, str) { | ||
var index = -1, length = 0; | ||
loc = { res: extend(base.res, locale.res) }; | ||
for (var i = 0, len = array.length, item; i < len; i++) { | ||
item = array[i]; | ||
if (!str.indexOf(item) && item.length > length) { | ||
index = i; | ||
length = item.length; | ||
} | ||
} | ||
return { value: index, length: length }; | ||
}, | ||
pre: function (str) { return str; } | ||
} | ||
} | ||
loc.formatter = extend(base.formatter, locale.formatter, loc.res); | ||
loc.parser = extend(base.parser, locale.parser, loc.res); | ||
locales[code] = loc; | ||
}; | ||
@@ -121,8 +147,7 @@ | ||
var d = date.addMinutes(dateObj, utc ? dateObj.getTimezoneOffset() : 0), | ||
locale = locales[lang], formatter = locale.formatter; | ||
formatter = locales[lang].formatter; | ||
d.utc = utc; | ||
return formatString.replace(/(\[[^\[\]]*]|\[.*\][^\[]*\]|YYYY|YY|MMM?M?|DD|HH|hh|mm|ss|SSS?|ddd?d?|.)/g, function (token) { | ||
var format = formatter[token]; | ||
return format ? formatter.post(format.call(locale, d, formatString)) : token.replace(/\[(.*)]/, '$1'); | ||
return formatString.replace(/\[[^\[\]]*]|\[.*\][^\[]*\]|([A-Za-z])\1*|./g, function (token) { | ||
return formatter[token] ? formatter.post(formatter[token](d, formatString)) : token.replace(/\[(.*)]/, '$1'); | ||
}); | ||
@@ -138,4 +163,4 @@ }; | ||
date.preparse = function (dateString, formatString) { | ||
var locale = locales[lang], parser = locale.parser, | ||
re = /YYYY|YY|MMMM?|MM?|DD?|HH?|A|hh?|mm?|ss?|SS?S?|./g, | ||
var parser = locales[lang].parser, | ||
re = /([A-Za-z])\1*|./g, | ||
keys, token, result, offset = 0, | ||
@@ -146,3 +171,3 @@ dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, _index: 0, _length: 0, _match: 0 }; | ||
formatString = formatString.replace(/\[[^\[\]]*]|\[.*\][^\[]*\]/g, function (str) { | ||
return new Array(str.length - 1).join(' '); | ||
return str.replace(/./g, ' ').slice(2); | ||
}); | ||
@@ -152,3 +177,3 @@ while ((keys = re.exec(formatString))) { | ||
if (parser[token]) { | ||
result = parser[token].call(locale, dateString.slice(offset), formatString); | ||
result = parser[token](dateString.slice(offset), formatString); | ||
if (!result.length) { | ||
@@ -335,11 +360,11 @@ break; | ||
/** | ||
* setting a locale | ||
* change locale or setting a new locale definition | ||
* @param {string} [code] - language code | ||
* @param {Object} [locale] - locale definition | ||
* @returns {string} current language code | ||
*/ | ||
date.locale = function (code) { | ||
if (code) { | ||
if (!locales[code] && typeof require === 'function' && global) { | ||
require('./locale/' + code); | ||
} | ||
date.locale = function (code, locale) { | ||
if (locale) { | ||
customize(code, { res: _res, formatter: _formatter, parser: _parser }, locale); | ||
} else if (code) { | ||
lang = code; | ||
@@ -351,41 +376,26 @@ } | ||
/** | ||
* getting a definition of locale | ||
* @param {string} [code] - language code | ||
* @returns {Object} definition of locale | ||
* locale extension | ||
* @param {Object} extension - locale extension | ||
* @returns {void} | ||
*/ | ||
date.getLocales = function (code) { | ||
return locales[code || lang]; | ||
date.extend = function (extension) { | ||
customize(lang, locales[lang], extension); | ||
}; | ||
/** | ||
* adding a new definition of locale | ||
* @param {string} code - language code | ||
* @param {Object} options - definition of locale | ||
* plugin import or definition | ||
* @param {string} name - plugin name | ||
* @param {Object} [extension] - locale extension | ||
* @returns {void} | ||
*/ | ||
date.setLocales = function (code, options) { | ||
var copy = function (src, proto) { | ||
var Locale = function () {}, dst, key; | ||
Locale.prototype = proto; | ||
dst = new Locale(); | ||
for (key in src) { | ||
if (src.hasOwnProperty(key)) { | ||
dst[key] = src[key]; | ||
} | ||
} | ||
return dst; | ||
}, | ||
base = locales[code] || locales.en, | ||
locale = copy(options, base); | ||
if (options.formatter) { | ||
locale.formatter = copy(options.formatter, base.formatter); | ||
date.plugin = function (name, extension) { | ||
plugins[name] = plugins[name] || extension; | ||
if (!extension && plugins[name]) { | ||
date.extend(plugins[name]); | ||
} | ||
if (options.parser) { | ||
locale.parser = copy(options.parser, base.parser); | ||
} | ||
locales[code] = locale; | ||
}; | ||
// Create default locale (English) | ||
date.locale(lang, {}); | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
@@ -392,0 +402,0 @@ module.exports = date; |
/* | ||
date-and-time.js (c) KNOWLEDGECODE | MIT | ||
*/ | ||
(function(p){var c={},l="en",k={en:{MMMM:"January February March April May June July August September October November December".split(" "),MMM:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dddd:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ddd:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dd:"Su Mo Tu We Th Fr Sa".split(" "),A:["a.m.","p.m."],formatter:{YYYY:function(a){return("000"+a.getFullYear()).slice(-4)},YY:function(a){return("0"+a.getFullYear()).slice(-2)}, | ||
Y:function(a){return""+a.getFullYear()},MMMM:function(a){return this.MMMM[a.getMonth()]},MMM:function(a){return this.MMM[a.getMonth()]},MM:function(a){return("0"+(a.getMonth()+1)).slice(-2)},M:function(a){return""+(a.getMonth()+1)},DD:function(a){return("0"+a.getDate()).slice(-2)},D:function(a){return""+a.getDate()},HH:function(a){return("0"+a.getHours()).slice(-2)},H:function(a){return""+a.getHours()},A:function(a){return this.A[11<a.getHours()|0]},hh:function(a){return("0"+(a.getHours()%12||12)).slice(-2)}, | ||
h:function(a){return""+(a.getHours()%12||12)},mm:function(a){return("0"+a.getMinutes()).slice(-2)},m:function(a){return""+a.getMinutes()},ss:function(a){return("0"+a.getSeconds()).slice(-2)},s:function(a){return""+a.getSeconds()},SSS:function(a){return("00"+a.getMilliseconds()).slice(-3)},SS:function(a){return("0"+(a.getMilliseconds()/10|0)).slice(-2)},S:function(a){return""+(a.getMilliseconds()/100|0)},dddd:function(a){return this.dddd[a.getDay()]},ddd:function(a){return this.ddd[a.getDay()]},dd:function(a){return this.dd[a.getDay()]}, | ||
Z:function(a){a=a.utc?0:a.getTimezoneOffset()/.6;return(0<a?"-":"+")+("000"+Math.abs(a-a%100*.4)).slice(-4)},post:function(a){return a}},parser:{YYYY:function(a){return this.parser.exec(/^\d{1,4}/,a)},YY:function(a){a=this.parser.exec(/^\d\d?/,a);a.value+=70>a.value?2E3:100>a.value?1900:0;return a},MMMM:function(a){a=this.parser.find(this.MMMM,a);a.value++;return a},MMM:function(a){a=this.parser.find(this.MMM,a);a.value++;return a},MM:function(a){return this.parser.exec(/^\d\d/,a)},M:function(a){return this.parser.exec(/^\d\d?/, | ||
a)},DD:function(a){return this.parser.exec(/^\d\d/,a)},D:function(a){return this.parser.exec(/^\d\d?/,a)},HH:function(a){return this.parser.exec(/^\d\d/,a)},H:function(a){return this.parser.exec(/^\d\d?/,a)},A:function(a){return this.parser.find(this.A,a)},hh:function(a){return this.parser.exec(/^\d\d/,a)},h:function(a){return this.parser.exec(/^\d\d?/,a)},mm:function(a){return this.parser.exec(/^\d\d/,a)},m:function(a){return this.parser.exec(/^\d\d?/,a)},ss:function(a){return this.parser.exec(/^\d\d/, | ||
a)},s:function(a){return this.parser.exec(/^\d\d?/,a)},SSS:function(a){return this.parser.exec(/^\d{1,3}/,a)},SS:function(a){a=this.parser.exec(/^\d\d?/,a);a.value*=10;return a},S:function(a){a=this.parser.exec(/^\d/,a);a.value*=100;return a},h12:function(a,d){return(12===a?0:a)+12*d},exec:function(a,d){var b=(a.exec(d)||[""])[0];return{value:b|0,length:b.length}},find:function(a,d){for(var b=-1,c=0,e=0,f=a.length,g;e<f;e++)g=a[e],!d.indexOf(g)&&g.length>c&&(b=e,c=g.length);return{value:b,length:c}}, | ||
pre:function(a){return a}}}};c.format=function(a,d,b){var m=c.addMinutes(a,b?a.getTimezoneOffset():0),e=k[l],f=e.formatter;m.utc=b;return d.replace(/(\[[^\[\]]*]|\[.*\][^\[]*\]|YYYY|YY|MMM?M?|DD|HH|hh|mm|ss|SSS?|ddd?d?|.)/g,function(a){var b=f[a];return b?f.post(b.call(e,m,d)):a.replace(/\[(.*)]/,"$1")})};c.preparse=function(a,d){var b=k[l],c=b.parser,e=/YYYY|YY|MMMM?|MM?|DD?|HH?|A|hh?|mm?|ss?|SS?S?|./g,f,g=0,h={Y:1970,M:1,D:1,H:0,A:0,h:0,m:0,s:0,S:0,_index:0,_length:0,_match:0};a=c.pre(a);for(d= | ||
d.replace(/\[[^\[\]]*]|\[.*\][^\[]*\]/g,function(a){return Array(a.length-1).join(" ")});f=e.exec(d);)if(f=f[0],c[f]){var n=c[f].call(b,a.slice(g),d);if(!n.length)break;g+=n.length;h[f.charAt(0)]=n.value;h._match++}else if(f===a.charAt(g)||" "===f)g++;else break;h.H=h.H||c.h12(h.h,h.A);h._index=g;h._length=a.length;return h};c.isValid=function(a,d){var b="string"===typeof a?c.preparse(a,d):a,m=[31,28+c.isLeapYear(b.Y)|0,31,30,31,30,31,31,30,31,30,31][b.M-1];return!(1>b._index||1>b._length||b._index- | ||
b._length||1>b._match||1>b.Y||9999<b.Y||1>b.M||12<b.M||1>b.D||b.D>m||23<b.H||0>b.H||59<b.m||0>b.m||59<b.s||0>b.s||999<b.S||0>b.S)};c.parse=function(a,d,b){a=c.preparse(a,d);return c.isValid(a)?(a.M-=100>a.Y?22801:1,b=b?new Date(Date.UTC(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(NaN)};c.addYears=function(a,d){return c.addMonths(a,12*d)};c.addMonths=function(a,d){var b=new Date(a.getTime());b.setMonth(b.getMonth()+d);return b};c.addDays=function(a,d){var b=new Date(a.getTime()); | ||
b.setDate(b.getDate()+d);return b};c.addHours=function(a,d){return c.addMilliseconds(a,36E5*d)};c.addMinutes=function(a,d){return c.addMilliseconds(a,6E4*d)};c.addSeconds=function(a,d){return c.addMilliseconds(a,1E3*d)};c.addMilliseconds=function(a,d){return new Date(a.getTime()+d)};c.subtract=function(a,d){var b=a.getTime()-d.getTime();return{toMilliseconds:function(){return b},toSeconds:function(){return b/1E3|0},toMinutes:function(){return b/6E4|0},toHours:function(){return b/36E5|0},toDays:function(){return b/ | ||
864E5|0}}};c.isLeapYear=function(a){return!(a%4)&&!!(a%100)||!(a%400)};c.isSameDay=function(a,d){return c.format(a,"YYYYMMDD")===c.format(d,"YYYYMMDD")};c.locale=function(a){a&&(!k[a]&&"function"===typeof require&&p&&require("./locale/"+a),l=a);return l};c.getLocales=function(a){return k[a||l]};c.setLocales=function(a,d){var b=function(a,b){var c=function(){},d;c.prototype=b;c=new c;for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);return c},c=k[a]||k.en,e=b(d,c);d.formatter&&(e.formatter=b(d.formatter, | ||
c.formatter));d.parser&&(e.parser=b(d.parser,c.parser));k[a]=e};"object"===typeof module&&"object"===typeof module.exports?module.exports=c:"function"===typeof define&&define.amd?define([],function(){return c}):p.date=c})(this); | ||
(function(p){var d={},l={},g={},h="en",q={MMMM:"January February March April May June July August September October November December".split(" "),MMM:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dddd:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ddd:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dd:"Su Mo Tu We Th Fr Sa".split(" "),A:["a.m.","p.m."]},r={YYYY:function(a){return("000"+a.getFullYear()).slice(-4)},YY:function(a){return("0"+a.getFullYear()).slice(-2)}, | ||
Y:function(a){return""+a.getFullYear()},MMMM:function(a){return this.res.MMMM[a.getMonth()]},MMM:function(a){return this.res.MMM[a.getMonth()]},MM:function(a){return("0"+(a.getMonth()+1)).slice(-2)},M:function(a){return""+(a.getMonth()+1)},DD:function(a){return("0"+a.getDate()).slice(-2)},D:function(a){return""+a.getDate()},HH:function(a){return("0"+a.getHours()).slice(-2)},H:function(a){return""+a.getHours()},A:function(a){return this.res.A[11<a.getHours()|0]},hh:function(a){return("0"+(a.getHours()% | ||
12||12)).slice(-2)},h:function(a){return""+(a.getHours()%12||12)},mm:function(a){return("0"+a.getMinutes()).slice(-2)},m:function(a){return""+a.getMinutes()},ss:function(a){return("0"+a.getSeconds()).slice(-2)},s:function(a){return""+a.getSeconds()},SSS:function(a){return("00"+a.getMilliseconds()).slice(-3)},SS:function(a){return("0"+(a.getMilliseconds()/10|0)).slice(-2)},S:function(a){return""+(a.getMilliseconds()/100|0)},dddd:function(a){return this.res.dddd[a.getDay()]},ddd:function(a){return this.res.ddd[a.getDay()]}, | ||
dd:function(a){return this.res.dd[a.getDay()]},Z:function(a){a=a.utc?0:a.getTimezoneOffset()/.6;return(0<a?"-":"+")+("000"+Math.abs(a-a%100*.4)).slice(-4)},post:function(a){return a}},t={YYYY:function(a){return this.exec(/^\d{1,4}/,a)},YY:function(a){a=this.exec(/^\d\d?/,a);a.value+=70>a.value?2E3:100>a.value?1900:0;return a},MMMM:function(a){a=this.find(this.res.MMMM,a);a.value++;return a},MMM:function(a){a=this.find(this.res.MMM,a);a.value++;return a},MM:function(a){return this.exec(/^\d\d/,a)}, | ||
M:function(a){return this.exec(/^\d\d?/,a)},DD:function(a){return this.exec(/^\d\d/,a)},D:function(a){return this.exec(/^\d\d?/,a)},HH:function(a){return this.exec(/^\d\d/,a)},H:function(a){return this.exec(/^\d\d?/,a)},A:function(a){return this.find(this.res.A,a)},hh:function(a){return this.exec(/^\d\d/,a)},h:function(a){return this.exec(/^\d\d?/,a)},mm:function(a){return this.exec(/^\d\d/,a)},m:function(a){return this.exec(/^\d\d?/,a)},ss:function(a){return this.exec(/^\d\d/,a)},s:function(a){return this.exec(/^\d\d?/, | ||
a)},SSS:function(a){return this.exec(/^\d{1,3}/,a)},SS:function(a){a=this.exec(/^\d\d?/,a);a.value*=10;return a},S:function(a){a=this.exec(/^\d/,a);a.value*=100;return a},h12:function(a,c){return(12===a?0:a)+12*c},exec:function(a,c){var b=(a.exec(c)||[""])[0];return{value:b|0,length:b.length}},find:function(a,c){for(var b=-1,d=0,e=0,k=a.length,f;e<k;e++)f=a[e],!c.indexOf(f)&&f.length>d&&(b=e,d=f.length);return{value:b,length:d}},pre:function(a){return a}},n=function(a,c,b){var d=function(a,b,c){var d= | ||
function(a){a&&(this.res=a)};d.prototype=a;d.prototype.constructor=d;a=new d(c);for(var e in b||{})b.hasOwnProperty(e)&&(c=b[e],a[e]=c.slice?c.slice():c);return a},e={res:d(c.res,b.res)};e.formatter=d(c.formatter,b.formatter,e.res);e.parser=d(c.parser,b.parser,e.res);l[a]=e};d.format=function(a,c,b){var m=d.addMinutes(a,b?a.getTimezoneOffset():0),e=l[h].formatter;m.utc=b;return c.replace(/\[[^\[\]]*]|\[.*\][^\[]*\]|([A-Za-z])\1*|./g,function(a){return e[a]?e.post(e[a](m,c)):a.replace(/\[(.*)]/,"$1")})}; | ||
d.preparse=function(a,c){var b=l[h].parser,d=/([A-Za-z])\1*|./g,e,k=0,f={Y:1970,M:1,D:1,H:0,A:0,h:0,m:0,s:0,S:0,_index:0,_length:0,_match:0};a=b.pre(a);for(c=c.replace(/\[[^\[\]]*]|\[.*\][^\[]*\]/g,function(a){return a.replace(/./g," ").slice(2)});e=d.exec(c);)if(e=e[0],b[e]){var g=b[e](a.slice(k),c);if(!g.length)break;k+=g.length;f[e.charAt(0)]=g.value;f._match++}else if(e===a.charAt(k)||" "===e)k++;else break;f.H=f.H||b.h12(f.h,f.A);f._index=k;f._length=a.length;return f};d.isValid=function(a,c){var b= | ||
"string"===typeof a?d.preparse(a,c):a,g=[31,28+d.isLeapYear(b.Y)|0,31,30,31,30,31,31,30,31,30,31][b.M-1];return!(1>b._index||1>b._length||b._index-b._length||1>b._match||1>b.Y||9999<b.Y||1>b.M||12<b.M||1>b.D||b.D>g||23<b.H||0>b.H||59<b.m||0>b.m||59<b.s||0>b.s||999<b.S||0>b.S)};d.parse=function(a,c,b){a=d.preparse(a,c);return d.isValid(a)?(a.M-=100>a.Y?22801:1,b=b?new Date(Date.UTC(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(NaN)};d.addYears=function(a,c){return d.addMonths(a, | ||
12*c)};d.addMonths=function(a,c){var b=new Date(a.getTime());b.setMonth(b.getMonth()+c);return b};d.addDays=function(a,c){var b=new Date(a.getTime());b.setDate(b.getDate()+c);return b};d.addHours=function(a,c){return d.addMilliseconds(a,36E5*c)};d.addMinutes=function(a,c){return d.addMilliseconds(a,6E4*c)};d.addSeconds=function(a,c){return d.addMilliseconds(a,1E3*c)};d.addMilliseconds=function(a,c){return new Date(a.getTime()+c)};d.subtract=function(a,c){var b=a.getTime()-c.getTime();return{toMilliseconds:function(){return b}, | ||
toSeconds:function(){return b/1E3|0},toMinutes:function(){return b/6E4|0},toHours:function(){return b/36E5|0},toDays:function(){return b/864E5|0}}};d.isLeapYear=function(a){return!(a%4)&&!!(a%100)||!(a%400)};d.isSameDay=function(a,c){return d.format(a,"YYYYMMDD")===d.format(c,"YYYYMMDD")};d.locale=function(a,c){c?n(a,{res:q,formatter:r,parser:t},c):a&&(h=a);return h};d.extend=function(a){n(h,l[h],a)};d.plugin=function(a,c){g[a]=g[a]||c;!c&&g[a]&&d.extend(g[a])};d.locale(h,{});"object"===typeof module&& | ||
"object"===typeof module.exports?module.exports=d:"function"===typeof define&&define.amd?define([],function(){return d}):p.date=d})(this); |
@@ -9,15 +9,15 @@ /** | ||
var locale = function (date) { | ||
var num = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'], | ||
map = { '٠': 0, '١': 1, '٢': 2, '٣': 3, '٤': 4, '٥': 5, '٦': 6, '٧': 7, '٨': 8, '٩': 9 }; | ||
date.setLocales('ar', { | ||
MMMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'], | ||
MMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'], | ||
dddd: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], | ||
ddd: ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], | ||
dd: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], | ||
A: ['ص', 'م'], | ||
var exec = function (date) { | ||
date.locale('ar', { | ||
res: { | ||
MMMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'], | ||
MMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'], | ||
dddd: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], | ||
ddd: ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], | ||
dd: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], | ||
A: ['ص', 'م'] | ||
}, | ||
formatter: { | ||
post: function (str) { | ||
var num = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']; | ||
return str.replace(/\d/g, function (i) { | ||
@@ -30,2 +30,3 @@ return num[i | 0]; | ||
pre: function (str) { | ||
var map = { '٠': 0, '١': 1, '٢': 2, '٣': 3, '٤': 4, '٥': 5, '٦': 6, '٧': 7, '٨': 8, '٩': 9 }; | ||
return str.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (i) { | ||
@@ -40,9 +41,10 @@ return '' + map[i]; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('az', { | ||
MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], | ||
MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'], | ||
dddd: ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'], | ||
ddd: ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'], | ||
dd: ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'], | ||
A: ['gecə', 'səhər', 'gündüz', 'axşam'], | ||
var exec = function (date) { | ||
date.locale('az', { | ||
res: { | ||
MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], | ||
MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'], | ||
dddd: ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'], | ||
ddd: ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'], | ||
dd: ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'], | ||
A: ['gecə', 'səhər', 'gündüz', 'axşam'] | ||
}, | ||
formatter: { | ||
@@ -22,9 +24,9 @@ A: function (d) { | ||
if (h < 4) { | ||
return this.A[0]; // gecə | ||
return this.res.A[0]; // gecə | ||
} else if (h < 12) { | ||
return this.A[1]; // səhər | ||
return this.res.A[1]; // səhər | ||
} else if (h < 17) { | ||
return this.A[2]; // gündüz | ||
return this.res.A[2]; // gündüz | ||
} | ||
return this.A[3]; // axşam | ||
return this.res.A[3]; // axşam | ||
} | ||
@@ -44,9 +46,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('bn', { | ||
MMMM: ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], | ||
MMM: ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'], | ||
dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'], | ||
ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'], | ||
dd: ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'], | ||
A: ['রাত', 'সকাল', 'দুপুর', 'বিকাল'], | ||
var exec = function (date) { | ||
date.locale('bn', { | ||
res: { | ||
MMMM: ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], | ||
MMM: ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'], | ||
dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'], | ||
ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'], | ||
dd: ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'], | ||
A: ['রাত', 'সকাল', 'দুপুর', 'বিকাল'] | ||
}, | ||
formatter: { | ||
@@ -22,11 +24,11 @@ A: function (d) { | ||
if (h < 4) { | ||
return this.A[0]; // রাত | ||
return this.res.A[0]; // রাত | ||
} else if (h < 10) { | ||
return this.A[1]; // সকাল | ||
return this.res.A[1]; // সকাল | ||
} else if (h < 17) { | ||
return this.A[2]; // দুপুর | ||
return this.res.A[2]; // দুপুর | ||
} else if (h < 20) { | ||
return this.A[3]; // বিকাল | ||
return this.res.A[3]; // বিকাল | ||
} | ||
return this.A[0]; // রাত | ||
return this.res.A[0]; // রাত | ||
} | ||
@@ -50,9 +52,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,9 +9,11 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('cs', { | ||
MMMM: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], | ||
MMM: ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'], | ||
dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], | ||
ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], | ||
dd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'] | ||
var exec = function (date) { | ||
date.locale('cs', { | ||
res: { | ||
MMMM: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], | ||
MMM: ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'], | ||
dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], | ||
ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], | ||
dd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'] | ||
} | ||
}); | ||
@@ -21,9 +23,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('de', { | ||
MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], | ||
MMM: ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'], | ||
dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], | ||
ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'], | ||
dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], | ||
A: ['Uhr nachmittags', 'Uhr morgens'] | ||
var exec = function (date) { | ||
date.locale('de', { | ||
res: { | ||
MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], | ||
MMM: ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'], | ||
dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], | ||
ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'], | ||
dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], | ||
A: ['Uhr nachmittags', 'Uhr morgens'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,9 +9,11 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('dk', { | ||
MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], | ||
MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], | ||
dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'], | ||
ddd: ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'], | ||
dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'] | ||
var exec = function (date) { | ||
date.locale('dk', { | ||
res: { | ||
MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], | ||
MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], | ||
dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'], | ||
ddd: ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'], | ||
dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'] | ||
} | ||
}); | ||
@@ -21,9 +23,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,16 +9,16 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('el', { | ||
MMMM: { | ||
nominative: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'], | ||
genitive: ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου'] | ||
var exec = function (date) { | ||
date.locale('el', { | ||
res: { | ||
MMMM_nominative: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'], | ||
MMMM_genitive: ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου'], | ||
MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'], | ||
dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'], | ||
ddd: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'], | ||
dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'], | ||
A: ['πμ', 'μμ'] | ||
}, | ||
MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'], | ||
dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'], | ||
ddd: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'], | ||
dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'], | ||
A: ['πμ', 'μμ'], | ||
formatter: { | ||
MMMM: function (d, formatString) { | ||
return this.MMMM[/D.*MMMM/.test(formatString) ? 'genitive' : 'nominative'][d.getMonth()]; | ||
return this.res['MMMM_' + (/D.*MMMM/.test(formatString) ? 'genitive' : 'nominative')][d.getMonth()]; | ||
}, | ||
@@ -34,3 +34,3 @@ hh: function (d) { | ||
MMMM: function (str, formatString) { | ||
var result = this.parser.find(this.MMMM[/D.*MMMM/.test(formatString) ? 'genitive' : 'nominative'], str); | ||
var result = this.find(this.res['MMMM_' + (/D.*MMMM/.test(formatString) ? 'genitive' : 'nominative')], str); | ||
result.value++; | ||
@@ -44,9 +44,10 @@ return result; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('es', { | ||
MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], | ||
MMM: ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'], | ||
dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'], | ||
ddd: ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'], | ||
dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'], | ||
A: ['de la mañana', 'de la tarde', 'de la noche'], | ||
var exec = function (date) { | ||
date.locale('es', { | ||
res: { | ||
MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], | ||
MMM: ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'], | ||
dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'], | ||
ddd: ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'], | ||
dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'], | ||
A: ['de la mañana', 'de la tarde', 'de la noche'] | ||
}, | ||
formatter: { | ||
@@ -22,7 +24,7 @@ A: function (d) { | ||
if (h < 12) { | ||
return this.A[0]; // de la mañana | ||
return this.res.A[0]; // de la mañana | ||
} else if (h < 19) { | ||
return this.A[1]; // de la tarde | ||
return this.res.A[1]; // de la tarde | ||
} | ||
return this.A[2]; // de la noche | ||
return this.res.A[2]; // de la noche | ||
} | ||
@@ -42,9 +44,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,15 +9,15 @@ /** | ||
var locale = function (date) { | ||
var num = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'], | ||
map = { '۰': 0, '۱': 1, '۲': 2, '۳': 3, '۴': 4, '۵': 5, '۶': 6, '۷': 7, '۸': 8, '۹': 9 }; | ||
date.setLocales('fa', { | ||
MMMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], | ||
MMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], | ||
dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], | ||
ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], | ||
dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], | ||
A: ['قبل از ظهر', 'بعد از ظهر'], | ||
var exec = function (date) { | ||
date.locale('fa', { | ||
res: { | ||
MMMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], | ||
MMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], | ||
dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], | ||
ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], | ||
dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], | ||
A: ['قبل از ظهر', 'بعد از ظهر'] | ||
}, | ||
formatter: { | ||
post: function (str) { | ||
var num = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; | ||
return str.replace(/\d/g, function (i) { | ||
@@ -30,2 +30,3 @@ return num[i | 0]; | ||
pre: function (str) { | ||
var map = { '۰': 0, '۱': 1, '۲': 2, '۳': 3, '۴': 4, '۵': 5, '۶': 6, '۷': 7, '۸': 8, '۹': 9 }; | ||
return str.replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function (i) { | ||
@@ -40,9 +41,10 @@ return '' + map[i]; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('fr', { | ||
MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], | ||
MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], | ||
dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'], | ||
ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], | ||
dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], | ||
A: ['matin', 'l\'après-midi'] | ||
var exec = function (date) { | ||
date.locale('fr', { | ||
res: { | ||
MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], | ||
MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], | ||
dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'], | ||
ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], | ||
dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], | ||
A: ['matin', 'l\'après-midi'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('hi', { | ||
MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], | ||
MMM: ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'], | ||
dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'], | ||
ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'], | ||
dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'], | ||
A: ['रात', 'सुबह', 'दोपहर', 'शाम'], | ||
var exec = function (date) { | ||
date.locale('hi', { | ||
res: { | ||
MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], | ||
MMM: ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'], | ||
dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'], | ||
ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'], | ||
dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'], | ||
A: ['रात', 'सुबह', 'दोपहर', 'शाम'] | ||
}, | ||
formatter: { | ||
@@ -22,11 +24,11 @@ A: function (d) { | ||
if (h < 4) { | ||
return this.A[0]; // रात | ||
return this.res.A[0]; // रात | ||
} else if (h < 10) { | ||
return this.A[1]; // सुबह | ||
return this.res.A[1]; // सुबह | ||
} else if (h < 17) { | ||
return this.A[2]; // दोपहर | ||
return this.res.A[2]; // दोपहर | ||
} else if (h < 20) { | ||
return this.A[3]; // शाम | ||
return this.res.A[3]; // शाम | ||
} | ||
return this.A[0]; // रात | ||
return this.res.A[0]; // रात | ||
} | ||
@@ -50,9 +52,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('hu', { | ||
MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], | ||
MMM: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'], | ||
dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], | ||
ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'], | ||
dd: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'], | ||
A: ['de', 'du'] | ||
var exec = function (date) { | ||
date.locale('hu', { | ||
res: { | ||
MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], | ||
MMM: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'], | ||
dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], | ||
ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'], | ||
dd: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'], | ||
A: ['de', 'du'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('id', { | ||
MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'], | ||
MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'], | ||
dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'], | ||
ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'], | ||
dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'], | ||
A: ['pagi', 'siang', 'sore', 'malam'], | ||
var exec = function (date) { | ||
date.locale('id', { | ||
res: { | ||
MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'], | ||
MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'], | ||
dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'], | ||
ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'], | ||
dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'], | ||
A: ['pagi', 'siang', 'sore', 'malam'] | ||
}, | ||
formatter: { | ||
@@ -22,9 +24,9 @@ A: function (d) { | ||
if (h < 11) { | ||
return this.A[0]; // pagi | ||
return this.res.A[0]; // pagi | ||
} else if (h < 15) { | ||
return this.A[1]; // siang | ||
return this.res.A[1]; // siang | ||
} else if (h < 19) { | ||
return this.A[2]; // sore | ||
return this.res.A[2]; // sore | ||
} | ||
return this.A[3]; // malam | ||
return this.res.A[3]; // malam | ||
} | ||
@@ -46,9 +48,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('it', { | ||
MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], | ||
MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'], | ||
dddd: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'], | ||
ddd: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'], | ||
dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'], | ||
A: ['di mattina', 'di pomerrigio'] | ||
var exec = function (date) { | ||
date.locale('it', { | ||
res: { | ||
MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], | ||
MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'], | ||
dddd: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'], | ||
ddd: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'], | ||
dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'], | ||
A: ['di mattina', 'di pomerrigio'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('ja', { | ||
MMMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], | ||
ddd: ['日', '月', '火', '水', '木', '金', '土'], | ||
dd: ['日', '月', '火', '水', '木', '金', '土'], | ||
A: ['午前', '午後'], | ||
var exec = function (date) { | ||
date.locale('ja', { | ||
res: { | ||
MMMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], | ||
ddd: ['日', '月', '火', '水', '木', '金', '土'], | ||
dd: ['日', '月', '火', '水', '木', '金', '土'], | ||
A: ['午前', '午後'] | ||
}, | ||
formatter: { | ||
@@ -30,9 +32,10 @@ hh: function (d) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('jv', { | ||
MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'], | ||
MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'], | ||
dddd: ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'], | ||
ddd: ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'], | ||
dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'], | ||
A: ['enjing', 'siyang', 'sonten', 'ndalu'], | ||
var exec = function (date) { | ||
date.locale('jv', { | ||
res: { | ||
MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'], | ||
MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'], | ||
dddd: ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'], | ||
ddd: ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'], | ||
dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'], | ||
A: ['enjing', 'siyang', 'sonten', 'ndalu'] | ||
}, | ||
formatter: { | ||
@@ -22,9 +24,9 @@ A: function (d) { | ||
if (h < 11) { | ||
return this.A[0]; // enjing | ||
return this.res.A[0]; // enjing | ||
} else if (h < 15) { | ||
return this.A[1]; // siyang | ||
return this.res.A[1]; // siyang | ||
} else if (h < 19) { | ||
return this.A[2]; // sonten | ||
return this.res.A[2]; // sonten | ||
} | ||
return this.A[3]; // ndalu | ||
return this.res.A[3]; // ndalu | ||
} | ||
@@ -46,9 +48,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('ko', { | ||
MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], | ||
MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], | ||
dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], | ||
ddd: ['일', '월', '화', '수', '목', '금', '토'], | ||
dd: ['일', '월', '화', '수', '목', '금', '토'], | ||
A: ['오전', '오후'] | ||
var exec = function (date) { | ||
date.locale('ko', { | ||
res: { | ||
MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], | ||
MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], | ||
dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], | ||
ddd: ['일', '월', '화', '수', '목', '금', '토'], | ||
dd: ['일', '월', '화', '수', '목', '금', '토'], | ||
A: ['오전', '오후'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,14 +9,14 @@ /** | ||
var locale = function (date) { | ||
var num = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉'], | ||
map = { '၀': 0, '၁': 1, '၂': 2, '၃': 3, '၄': 4, '၅': 5, '၆': 6, '၇': 7, '၈': 8, '၉': 9 }; | ||
date.setLocales('my', { | ||
MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], | ||
MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'], | ||
dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'], | ||
ddd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], | ||
dd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], | ||
var exec = function (date) { | ||
date.locale('my', { | ||
res: { | ||
MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], | ||
MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'], | ||
dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'], | ||
ddd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], | ||
dd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'] | ||
}, | ||
formatter: { | ||
post: function (str) { | ||
var num = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉']; | ||
return str.replace(/\d/g, function (i) { | ||
@@ -29,2 +29,3 @@ return num[i | 0]; | ||
pre: function (str) { | ||
var map = { '၀': 0, '၁': 1, '၂': 2, '၃': 3, '၄': 4, '၅': 5, '၆': 6, '၇': 7, '၈': 8, '၉': 9 }; | ||
return str.replace(/[၀၁၂၃၄၅၆၇၈၉]/g, function (i) { | ||
@@ -39,9 +40,10 @@ return '' + map[i]; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,15 +9,15 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('nl', { | ||
MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], | ||
MMM: { | ||
withdots: ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'], | ||
withoutdots: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'] | ||
var exec = function (date) { | ||
date.locale('nl', { | ||
res: { | ||
MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], | ||
MMM_withdots: ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'], | ||
MMM_withoutdots: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], | ||
dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], | ||
ddd: ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'], | ||
dd: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'] | ||
}, | ||
dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], | ||
ddd: ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'], | ||
dd: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'], | ||
formatter: { | ||
MMM: function (d, formatString) { | ||
return this.MMM[/-MMM-/.test(formatString) ? 'withoutdots' : 'withdots'][d.getMonth()]; | ||
return this.res['MMM_' + (/-MMM-/.test(formatString) ? 'withoutdots' : 'withdots')][d.getMonth()]; | ||
} | ||
@@ -27,3 +27,3 @@ }, | ||
MMM: function (str, formatString) { | ||
var result = this.parser.find(this.MMM[/-MMM-/.test(formatString) ? 'withoutdots' : 'withdots'], str); | ||
var result = this.find(this.res['MMM_' + (/-MMM-/.test(formatString) ? 'withoutdots' : 'withdots')], str); | ||
result.value++; | ||
@@ -37,9 +37,10 @@ return result; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,13 +9,12 @@ /** | ||
var locale = function (date) { | ||
var num = ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'], | ||
map = { '੦': 0, '੧': 1, '੨': 2, '੩': 3, '੪': 4, '੫': 5, '੬': 6, '੭': 7, '੮': 8, '੯': 9 }; | ||
date.setLocales('pa-in', { | ||
MMMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], | ||
MMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], | ||
dddd: ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'], | ||
ddd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'], | ||
dd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'], | ||
A: ['ਰਾਤ', 'ਸਵੇਰ', 'ਦੁਪਹਿਰ', 'ਸ਼ਾਮ'], | ||
var exec = function (date) { | ||
date.locale('pa-in', { | ||
res: { | ||
MMMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], | ||
MMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], | ||
dddd: ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'], | ||
ddd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'], | ||
dd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'], | ||
A: ['ਰਾਤ', 'ਸਵੇਰ', 'ਦੁਪਹਿਰ', 'ਸ਼ਾਮ'] | ||
}, | ||
formatter: { | ||
@@ -25,13 +24,14 @@ A: function (d) { | ||
if (h < 4) { | ||
return this.A[0]; // ਰਾਤ | ||
return this.res.A[0]; // ਰਾਤ | ||
} else if (h < 10) { | ||
return this.A[1]; // ਸਵੇਰ | ||
return this.res.A[1]; // ਸਵੇਰ | ||
} else if (h < 17) { | ||
return this.A[2]; // ਦੁਪਹਿਰ | ||
return this.res.A[2]; // ਦੁਪਹਿਰ | ||
} else if (h < 20) { | ||
return this.A[3]; // ਸ਼ਾਮ | ||
return this.res.A[3]; // ਸ਼ਾਮ | ||
} | ||
return this.A[0]; // ਰਾਤ | ||
return this.res.A[0]; // ਰਾਤ | ||
}, | ||
post: function (str) { | ||
var num = ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯']; | ||
return str.replace(/\d/g, function (i) { | ||
@@ -54,2 +54,3 @@ return num[i | 0]; | ||
pre: function (str) { | ||
var map = { '੦': 0, '੧': 1, '੨': 2, '੩': 3, '੪': 4, '੫': 5, '੬': 6, '੭': 7, '੮': 8, '੯': 9 }; | ||
return str.replace(/[੦੧੨੩੪੫੬੭੮੯]/g, function (i) { | ||
@@ -64,9 +65,10 @@ return '' + map[i]; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,15 +9,15 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('pl', { | ||
MMMM: { | ||
nominative: ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'], | ||
subjective: ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia'] | ||
var exec = function (date) { | ||
date.locale('pl', { | ||
res: { | ||
MMMM_nominative: ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'], | ||
MMMM_subjective: ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia'], | ||
MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'], | ||
dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'], | ||
ddd: ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'], | ||
dd: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'] | ||
}, | ||
MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'], | ||
dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'], | ||
ddd: ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'], | ||
dd: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'], | ||
formatter: { | ||
MMMM: function (d, formatString) { | ||
return this.MMMM[/D MMMM/.test(formatString) ? 'subjective' : 'nominative'][d.getMonth()]; | ||
return this.res['MMMM_' + (/D MMMM/.test(formatString) ? 'subjective' : 'nominative')][d.getMonth()]; | ||
} | ||
@@ -27,3 +27,3 @@ }, | ||
MMMM: function (str, formatString) { | ||
var result = this.parser.find(this.MMMM[/D MMMM/.test(formatString) ? 'subjective' : 'nominative'], str); | ||
var result = this.find(this.res['MMMM_' + (/D MMMM/.test(formatString) ? 'subjective' : 'nominative')], str); | ||
result.value++; | ||
@@ -37,9 +37,10 @@ return result; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('pt', { | ||
MMMM: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], | ||
MMM: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'], | ||
dddd: ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'], | ||
ddd: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'], | ||
dd: ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'], | ||
A: ['da madrugada', 'da manhã', 'da tarde', 'da noite'], | ||
var exec = function (date) { | ||
date.locale('pt', { | ||
res: { | ||
MMMM: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], | ||
MMM: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'], | ||
dddd: ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'], | ||
ddd: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'], | ||
dd: ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'], | ||
A: ['da madrugada', 'da manhã', 'da tarde', 'da noite'] | ||
}, | ||
formatter: { | ||
@@ -22,9 +24,9 @@ A: function (d) { | ||
if (h < 5) { | ||
return this.A[0]; // da madrugada | ||
return this.res.A[0]; // da madrugada | ||
} else if (h < 12) { | ||
return this.A[1]; // da manhã | ||
return this.res.A[1]; // da manhã | ||
} else if (h < 19) { | ||
return this.A[2]; // da tarde | ||
return this.res.A[2]; // da tarde | ||
} | ||
return this.A[3]; // da noite | ||
return this.res.A[3]; // da noite | ||
} | ||
@@ -44,9 +46,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,9 +9,11 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('ro', { | ||
MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'], | ||
MMM: ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'], | ||
dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'], | ||
ddd: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'], | ||
dd: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ'] | ||
var exec = function (date) { | ||
date.locale('ro', { | ||
res: { | ||
MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'], | ||
MMM: ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'], | ||
dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'], | ||
ddd: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'], | ||
dd: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ'] | ||
} | ||
}); | ||
@@ -21,9 +23,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('ru', { | ||
MMMM: ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'], | ||
MMM: ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'], | ||
dddd: ['Воскресенье', 'Понедельник', 'Вторник', 'Среду', 'Четверг', 'Пятницу', 'Субботу'], | ||
ddd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], | ||
dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], | ||
A: ['ночи', 'утра', 'дня', 'вечера'], | ||
var exec = function (date) { | ||
date.locale('ru', { | ||
res: { | ||
MMMM: ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'], | ||
MMM: ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'], | ||
dddd: ['Воскресенье', 'Понедельник', 'Вторник', 'Среду', 'Четверг', 'Пятницу', 'Субботу'], | ||
ddd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], | ||
dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], | ||
A: ['ночи', 'утра', 'дня', 'вечера'] | ||
}, | ||
formatter: { | ||
@@ -22,9 +24,9 @@ A: function (d) { | ||
if (h < 4) { | ||
return this.A[0]; // ночи | ||
return this.res.A[0]; // ночи | ||
} else if (h < 12) { | ||
return this.A[1]; // утра | ||
return this.res.A[1]; // утра | ||
} else if (h < 17) { | ||
return this.A[2]; // дня | ||
return this.res.A[2]; // дня | ||
} | ||
return this.A[3]; // вечера | ||
return this.res.A[3]; // вечера | ||
} | ||
@@ -44,9 +46,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,9 +9,11 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('sr', { | ||
MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'], | ||
MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'], | ||
dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], | ||
ddd: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'], | ||
dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'] | ||
var exec = function (date) { | ||
date.locale('sr', { | ||
res: { | ||
MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'], | ||
MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'], | ||
dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], | ||
ddd: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'], | ||
dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'] | ||
} | ||
}); | ||
@@ -21,9 +23,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('th', { | ||
MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'], | ||
MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'], | ||
dddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'], | ||
ddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'], | ||
dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'], | ||
A: ['ก่อนเที่ยง', 'หลังเที่ยง'] | ||
var exec = function (date) { | ||
date.locale('th', { | ||
res: { | ||
MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'], | ||
MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'], | ||
dddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'], | ||
ddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'], | ||
dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'], | ||
A: ['ก่อนเที่ยง', 'หลังเที่ยง'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,9 +9,11 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('tr', { | ||
MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], | ||
MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'], | ||
dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'], | ||
ddd: ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'], | ||
dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'] | ||
var exec = function (date) { | ||
date.locale('tr', { | ||
res: { | ||
MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], | ||
MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'], | ||
dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'], | ||
ddd: ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'], | ||
dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'] | ||
} | ||
}); | ||
@@ -21,9 +23,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,14 +9,14 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('uk', { | ||
MMMM: ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'], | ||
MMM: ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'], | ||
dddd: { | ||
nominative: ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'], | ||
accusative: ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'], | ||
genitive: ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи'] | ||
var exec = function (date) { | ||
date.locale('uk', { | ||
res: { | ||
MMMM: ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'], | ||
MMM: ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'], | ||
dddd_nominative: ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'], | ||
dddd_accusative: ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'], | ||
dddd_genitive: ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи'], | ||
ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], | ||
dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], | ||
A: ['ночі', 'ранку', 'дня', 'вечора'] | ||
}, | ||
ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], | ||
dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], | ||
A: ['ночі', 'ранку', 'дня', 'вечора'], | ||
formatter: { | ||
@@ -26,9 +26,9 @@ A: function (d) { | ||
if (h < 4) { | ||
return this.A[0]; // ночі | ||
return this.res.A[0]; // ночі | ||
} else if (h < 12) { | ||
return this.A[1]; // ранку | ||
return this.res.A[1]; // ранку | ||
} else if (h < 17) { | ||
return this.A[2]; // дня | ||
return this.res.A[2]; // дня | ||
} | ||
return this.A[3]; // вечора | ||
return this.res.A[3]; // вечора | ||
}, | ||
@@ -42,3 +42,3 @@ dddd: function (d, formatString) { | ||
} | ||
return this.dddd[type][d.getDay()]; | ||
return this.res['dddd_' + type][d.getDay()]; | ||
} | ||
@@ -58,9 +58,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,9 +9,11 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('uz', { | ||
MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], | ||
MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], | ||
dddd: ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'], | ||
ddd: ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'], | ||
dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша'] | ||
var exec = function (date) { | ||
date.locale('uz', { | ||
res: { | ||
MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], | ||
MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], | ||
dddd: ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'], | ||
ddd: ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'], | ||
dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша'] | ||
} | ||
}); | ||
@@ -21,9 +23,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('vi', { | ||
MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'], | ||
MMM: ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'], | ||
dddd: ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'], | ||
ddd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], | ||
dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], | ||
A: ['sa', 'ch'] | ||
var exec = function (date) { | ||
date.locale('vi', { | ||
res: { | ||
MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'], | ||
MMM: ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'], | ||
dddd: ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'], | ||
ddd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], | ||
dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], | ||
A: ['sa', 'ch'] | ||
} | ||
}); | ||
@@ -22,9 +24,10 @@ }; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('zh-cn', { | ||
MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], | ||
ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], | ||
dd: ['日', '一', '二', '三', '四', '五', '六'], | ||
A: ['凌晨', '早上', '上午', '中午', '下午', '晚上'], | ||
var exec = function (date) { | ||
date.locale('zh-cn', { | ||
res: { | ||
MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], | ||
ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], | ||
dd: ['日', '一', '二', '三', '四', '五', '六'], | ||
A: ['凌晨', '早上', '上午', '中午', '下午', '晚上'] | ||
}, | ||
formatter: { | ||
@@ -22,13 +24,13 @@ A: function (d) { | ||
if (hm < 600) { | ||
return this.A[0]; // 凌晨 | ||
return this.res.A[0]; // 凌晨 | ||
} else if (hm < 900) { | ||
return this.A[1]; // 早上 | ||
return this.res.A[1]; // 早上 | ||
} else if (hm < 1130) { | ||
return this.A[2]; // 上午 | ||
return this.res.A[2]; // 上午 | ||
} else if (hm < 1230) { | ||
return this.A[3]; // 中午 | ||
return this.res.A[3]; // 中午 | ||
} else if (hm < 1800) { | ||
return this.A[4]; // 下午 | ||
return this.res.A[4]; // 下午 | ||
} | ||
return this.A[5]; // 晚上 | ||
return this.res.A[5]; // 晚上 | ||
} | ||
@@ -48,9 +50,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
@@ -9,10 +9,12 @@ /** | ||
var locale = function (date) { | ||
date.setLocales('zh-tw', { | ||
MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], | ||
ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], | ||
dd: ['日', '一', '二', '三', '四', '五', '六'], | ||
A: ['早上', '上午', '中午', '下午', '晚上'], | ||
var exec = function (date) { | ||
date.locale('zh-tw', { | ||
res: { | ||
MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], | ||
dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], | ||
ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], | ||
dd: ['日', '一', '二', '三', '四', '五', '六'], | ||
A: ['早上', '上午', '中午', '下午', '晚上'] | ||
}, | ||
formatter: { | ||
@@ -22,11 +24,11 @@ A: function (d) { | ||
if (hm < 900) { | ||
return this.A[0]; // 早上 | ||
return this.res.A[0]; // 早上 | ||
} else if (hm < 1130) { | ||
return this.A[1]; // 上午 | ||
return this.res.A[1]; // 上午 | ||
} else if (hm < 1230) { | ||
return this.A[2]; // 中午 | ||
return this.res.A[2]; // 中午 | ||
} else if (hm < 1800) { | ||
return this.A[3]; // 下午 | ||
return this.res.A[3]; // 下午 | ||
} | ||
return this.A[4]; // 晚上 | ||
return this.res.A[4]; // 晚上 | ||
} | ||
@@ -46,9 +48,10 @@ }, | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
locale(require('../date-and-time')); | ||
(module.paths || []).push('./'); | ||
exec(require('date-and-time')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(['date-and-time'], locale); | ||
define(['date-and-time'], exec); | ||
} else { | ||
locale(global.date); | ||
exec(global.date); | ||
} | ||
}(this)); |
{ | ||
"name": "date-and-time", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "A Minimalist DateTime utility for Node.js and the browser", | ||
@@ -35,3 +35,6 @@ "main": "date-and-time.js", | ||
"phantomjs-prebuilt": "^2.1.16" | ||
}, | ||
"browser": { | ||
"date-and-time": "./date-and-time.js" | ||
} | ||
} |
238
README.md
# date-and-time | ||
[![Circle CI](https://circleci.com/gh/knowledgecode/date-and-time.svg?style=shield)](https://circleci.com/gh/knowledgecode/date-and-time) | ||
## What | ||
This library is just a function collection for manipulation of date and time. It's tiny, simple, easy to learn. | ||
This library is just a function collection for manipulating JS date and time. It's tiny, simple, easy to learn. | ||
## Why | ||
Because JS modules nowadays are getting more huge and complex, and there are many dependencies. Trying to keep simple and small each module is meaningful. | ||
Because JS modules nowadays are getting more huge and complex, and there are also many dependencies. Trying to keep each module simple and small is meaningful. | ||
## Features | ||
- Minimalist. Less than 2k. (minified and gzipped) | ||
- Universal (Isomorphic) | ||
- Multi language support | ||
- Not extending built-in Date object | ||
- Old browser support. It even works on IE6 | ||
- Universal / Isomorphic. Wherever JS runtime works. | ||
- Multi language support. | ||
- Not extending built-in Date object. | ||
- Older browser support. Even works on IE6. :) | ||
## Install | ||
via npm: | ||
- via npm: | ||
```shell | ||
$ npm install date-and-time --save | ||
``` | ||
via Bower (DEPRECATED): | ||
```shell | ||
$ bower install date-and-time | ||
``` | ||
directly: | ||
- using directly: | ||
```html | ||
<script src="date-and-time.min.js"></script> | ||
<script src="/path/to/date-and-time.min.js"></script> | ||
``` | ||
## Changes | ||
## Recent Changes | ||
- 0.9.0 (Locale Update) | ||
- Renewal of the locale system. Some functions were merged (**Breaking Change**). | ||
- Added a plugin system. You could extend the formatter and the parser by using it. | ||
- The `format()` has come to support a user original token in association with the plugin system. | ||
- 0.8.0 (Parser Update) | ||
- The `parse()` has become to return `Invalid Date` instead of `NaN` when parsing is failure (**Breaking Change**). | ||
- The `parse()` has come to return `Invalid Date` instead of `NaN` when parsing is failure (**Breaking Change**). | ||
- Added `preparse()`. It returns a Date Structure. | ||
- The `isValid()` has become to take a Date Structure in addition to a date string. | ||
- The `isLeapYear()` has become to take a year (number type) instead of a Date object (**Breaking Change**). | ||
- The `isValid()` has come to take a Date Structure in addition to a date string. | ||
- The `isLeapYear()` has come to take a year (number type) instead of a Date object (**Breaking Change**). | ||
- 0.7.0 | ||
- Added Danish support | ||
## Usage | ||
Node.js: | ||
- Node.js: | ||
```javascript | ||
const date = require('date-and-time'); | ||
``` | ||
Babel: | ||
- ES6 transpiler: | ||
```javascript | ||
import date from 'date-and-time'; | ||
``` | ||
AMD: | ||
- Browser: | ||
```javascript | ||
require(['date-and-time'], function (date) { | ||
}); | ||
``` | ||
Browser: | ||
```javascript | ||
window.date; // global object | ||
@@ -72,3 +64,3 @@ ``` | ||
date.format(now, 'YYYY/MM/DD HH:mm:ss'); // => '2015/01/02 23:14:05' | ||
date.format(now, 'ddd MMM DD YYYY'); // => 'Fri Jan 02 2015' | ||
date.format(now, 'ddd., MMM. DD YYYY'); // => 'Fri., Jan. 02 2015' | ||
date.format(now, 'hh:mm A [GMT]Z'); // => '11:14 p.m. GMT-0800' | ||
@@ -78,2 +70,4 @@ date.format(now, 'hh:mm A [GMT]Z', true); // => '07:14 a.m. GMT+0000' | ||
Available tokens and their meanings are as follows: | ||
| token | meaning | example | | ||
@@ -115,2 +109,13 @@ |:-------------|:------------|:------------------| | ||
#### NOTE 2. UTC | ||
This function usually outputs a local date-time string. Set to true a `utc` option (the 3rd parameter) if you would like to get a UTC date/time string. | ||
```javascript | ||
date.format(new Date(), 'hh:mm A [GMT]Z'); // => '11:14 p.m. GMT-0800' | ||
date.format(new Date(), 'hh:mm A [GMT]Z', true); // => '07:14 a.m. GMT+0000' | ||
``` | ||
#### NOTE 3. More Tokens | ||
You could also define your own tokens. See [PLUGINS.md](./PLUGINS.md) for details. | ||
--- | ||
@@ -126,11 +131,13 @@ | ||
```javascript | ||
date.parse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => Jan 2 2015 23:14:05 GMT-0800 | ||
date.parse('02-01-2015', 'DD-MM-YYYY'); // => Jan 2 2015 00:00:00 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A', true); // => Jan 1 1970 15:14:05 GMT-0800 | ||
date.parse('Jam 1 2017', 'MMM D YYYY'); // => Invalid Date | ||
date.parse('Feb 29 2016', 'MMM D YYYY'); // => Feb 29 2016 00:00:00 GMT-0800 | ||
date.parse('Feb 29 2017', 'MMM D YYYY'); // => Invalid Date | ||
date.parse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => Jan. 2 2015 23:14:05 GMT-0800 | ||
date.parse('02-01-2015', 'DD-MM-YYYY'); // => Jan. 2 2015 00:00:00 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan. 1 1970 23:14:05 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A', true); // => Jan. 1 1970 15:14:05 GMT-0800 | ||
date.parse('Jam. 1 2017', 'MMM. D YYYY'); // => Invalid Date | ||
date.parse('Feb. 29 2016', 'MMM. D YYYY'); // => Feb. 29 2016 00:00:00 GMT-0800 | ||
date.parse('Feb. 29 2017', 'MMM. D YYYY'); // => Invalid Date | ||
``` | ||
Available tokens and their meanings are as follows: | ||
| token | meaning | example | | ||
@@ -160,6 +167,6 @@ |:-------------|:------------|:------------------| | ||
#### NOTE 1. Invalid Date | ||
If the function fails to parse, it will return `Invalid Date`. Be careful as the `Invalid Date` is a Date object, not `NaN` or `null`. You can tell whether the Date object is invalid as follows: | ||
If the function fails to parse, it will return `Invalid Date`. Notice that the `Invalid Date` is a Date object, not `NaN` or `null`. You could tell whether the Date object is invalid as follows: | ||
```javascript | ||
const today = date.parse('Jam 1 2017', 'MMM D YYYY'); | ||
const today = date.parse('Jam. 1 2017', 'MMM. D YYYY'); | ||
@@ -171,40 +178,48 @@ if (isNaN(today)) { | ||
#### NOTE 2. Default Date Time | ||
Default date is `January 1, 1970`, time is `00:00:00.000`. Not passed values will be replaced with them: | ||
#### NOTE 2. UTC | ||
This function usually assumes the `dateString` is local date-time. Set to true a `utc` option (the 3rd parameter) if it is UTC. | ||
```javascript | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800 | ||
date.parse('Feb 2000', 'MMM YYYY'); // => Feb 1 2000 00:00:00 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan. 1 1970 23:14:05 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A', true); // => Jan. 1 1970 15:14:05 GMT-0800 | ||
``` | ||
#### NOTE 3. Max Date / Min Date | ||
#### NOTE 3. Default Date Time | ||
Default date is `January 1, 1970`, time is `00:00:00.000`. Values not passed will be complemented with them: | ||
```javascript | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan. 1 1970 23:14:05 GMT-0800 | ||
date.parse('Feb. 2000', 'MMM. YYYY'); // => Feb. 1 2000 00:00:00 GMT-0800 | ||
``` | ||
#### NOTE 4. Max Date / Min Date | ||
Parsable maximum date is `December 31, 9999`, minimum date is `January 1, 0001`. | ||
```javascript | ||
date.parse('Dec 31 9999', 'MMM D YYYY'); // => Dec 31 9999 00:00:00 GMT-0800 | ||
date.parse('Dec 31 10000', 'MMM D YYYY'); // => Invalid Date | ||
date.parse('Dec. 31 9999', 'MMM. D YYYY'); // => Dec. 31 9999 00:00:00 GMT-0800 | ||
date.parse('Dec. 31 10000', 'MMM. D YYYY'); // => Invalid Date | ||
date.parse('Jan 1 0001', 'MMM D YYYY'); // => Jan 1 0001 00:00:00 GMT-0800 | ||
date.parse('Jan 1 0000', 'MMM D YYYY'); // => Invalid Date | ||
date.parse('Jan. 1 0001', 'MMM. D YYYY'); // => Jan. 1 0001 00:00:00 GMT-0800 | ||
date.parse('Jan. 1 0000', 'MMM. D YYYY'); // => Invalid Date | ||
``` | ||
#### NOTE 4. Auto Mapping | ||
The `YY` token maps the year 69 or less to 2000s, the year 70 or more to 1900s. Using it is not recommended. | ||
#### NOTE 5. Auto Mapping | ||
The `YY` token maps the year 69 or less to the 2000s, the year 70 or more to the 1900s. Using it is not recommended. | ||
```javascript | ||
date.parse('Dec 31 0', 'MMM D YY'); // => Dec 31 2000 00:00:00 GMT-0800 | ||
date.parse('Dec 31 69', 'MMM D YY'); // => Dec 31 2069 00:00:00 GMT-0800 | ||
date.parse('Dec 31 70', 'MMM D YY'); // => Dec 31 1970 00:00:00 GMT-0800 | ||
date.parse('Dec 31 99', 'MMM D YY'); // => Dec 31 1999 00:00:00 GMT-0800 | ||
date.parse('Dec. 31 0', 'MMM. D YY'); // => Dec. 31 2000 00:00:00 GMT-0800 | ||
date.parse('Dec. 31 69', 'MMM. D YY'); // => Dec. 31 2069 00:00:00 GMT-0800 | ||
date.parse('Dec. 31 70', 'MMM. D YY'); // => Dec. 31 1970 00:00:00 GMT-0800 | ||
date.parse('Dec. 31 99', 'MMM. D YY'); // => Dec. 31 1999 00:00:00 GMT-0800 | ||
``` | ||
#### NOTE 5. 12-hour notation and Meridiem | ||
#### NOTE 6. 12-hour notation and Meridiem | ||
If use the `hh` or `h` (12-hour) token, use together the `A` (meridiem) token to get the right value. | ||
```javascript | ||
date.parse('11:14:05', 'hh:mm:ss'); // => Jan 1 1970 11:14:05 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800 | ||
date.parse('11:14:05', 'hh:mm:ss'); // => Jan. 1 1970 11:14:05 GMT-0800 | ||
date.parse('11:14:05 p.m.', 'hh:mm:ss A'); // => Jan. 1 1970 23:14:05 GMT-0800 | ||
``` | ||
#### NOTE 6. Comments | ||
#### NOTE 7. Comments | ||
Strings in parenthese `[...]` in the formatString will be ignored as comments: | ||
@@ -214,9 +229,9 @@ | ||
date.parse('12 hours 34 minutes', 'HH hours mm minutes'); // => Invalid Date | ||
date.parse('12 hours 34 minutes', 'HH [hours] mm [minutes]'); // => Jan 1 1970 12:34:00 GMT-0800 | ||
date.parse('12 hours 34 minutes', 'HH [hours] mm [minutes]'); // => Jan. 1 1970 12:34:00 GMT-0800 | ||
``` | ||
A white space works as a wild card, so that you can also write as follows: | ||
As a white space works as a wild card, you could also write as follows: | ||
```javascript | ||
date.parse('12 hours 34 minutes', 'HH mm '); // => Jan 1 1970 12:34:00 GMT-0800 | ||
date.parse('12 hours 34 minutes', 'HH mm '); // => Jan. 1 1970 12:34:00 GMT-0800 | ||
``` | ||
@@ -232,3 +247,3 @@ | ||
This function takes exactly the same parameters with the `parse()`, but instead it returns a date structure like this: | ||
This function takes exactly the same parameters with the `parse()`, but returns a date structure as follows unlike it: | ||
@@ -254,3 +269,3 @@ ```javascript | ||
This object shows a parsing result. You can realize from it how the date string was parsed(, or why the parsing was failed). | ||
This object shows a parsing result. You will be able to tell from it how the date string was parsed(, or why the parsing was failed). | ||
@@ -285,3 +300,3 @@ --- | ||
const now = new Date(); | ||
const next_year = date.addYears(now, 1); // => Date object | ||
const next_year = date.addYears(now, 1); | ||
``` | ||
@@ -409,5 +424,5 @@ | ||
```javascript | ||
const date1 = new Date(2017, 0, 2, 0); // Jan 2 2017 00:00:00 | ||
const date2 = new Date(2017, 0, 2, 23, 59); // Jan 2 2017 23:59:00 | ||
const date3 = new Date(2017, 0, 1, 23, 59); // Jan 1 2017 23:59:00 | ||
const date1 = new Date(2017, 0, 2, 0); // Jan. 2 2017 00:00:00 | ||
const date2 = new Date(2017, 0, 2, 23, 59); // Jan. 2 2017 23:59:00 | ||
const date3 = new Date(2017, 0, 1, 23, 59); // Jan. 1 2017 23:59:00 | ||
date.isSameDay(date1, date2); // => true | ||
@@ -419,84 +434,43 @@ date.isSameDay(date1, date3); // => false | ||
### locale([code]) | ||
*Setting a locale* | ||
### locale([code[, locale]]) | ||
*Change locale or setting a new locale definition* | ||
- @param {**string**} [code] - language code | ||
- @param {**Object**} [locale] - locale definition | ||
- @returns {**string**} current language code | ||
See the `Locale` section for details. | ||
Returns current language code if called without any parameters. | ||
--- | ||
```javascript | ||
date.locale(); // "en" | ||
``` | ||
### getLocales([code]) | ||
*Getting a definition of locale* | ||
- @param {**string**} [code] - language code | ||
- @returns {**Object**} definition of locale | ||
To switch to any other language, call it with a language code. | ||
See the `Locale` section for details. | ||
--- | ||
### setLocales(code, options) | ||
*Adding a new definition of locale* | ||
- @param {**string**} code - language code | ||
- @param {**Object**} options - definition of locale | ||
See the `Locale` section for details. | ||
--- | ||
## Locale | ||
Although month, day of week, and meridiem (am / pm) are displayed in English, you can switch to other languages as follows: | ||
Node.js: | ||
```javascript | ||
const date = require('date-and-time'); | ||
date.locale('fr'); // French | ||
date.format(new Date(), 'dddd D MMMM'); // => 'lundi 11 janvier' | ||
date.locale('es'); // Switch to Spanish | ||
``` | ||
Babel: | ||
```javascript | ||
import date from 'date-and-time'; | ||
import 'date-and-time/locale/it'; | ||
To define a new locale, call it with new language code and a locale definition. See [LOCALE.md](./LOCALE.md) for details. | ||
date.locale('it'); // Italian | ||
date.format(new Date(), 'dddd D MMMM'); // => 'Lunedì 11 gennaio' | ||
``` | ||
--- | ||
AMD: | ||
```javascript | ||
require(['date-and-time', 'locale/de'], function (date) { | ||
date.locale('de'); // German | ||
date.format(new Date(), 'dddd, D. MMMM'); // => 'Montag, 11. Januar' | ||
}); | ||
``` | ||
### extend(extension) | ||
*Locale extension* | ||
- @param {**Object**} extension - locale definition | ||
- @returns {**void**} | ||
Browser: | ||
```html | ||
<script src="date-and-time.min.js"></script> | ||
<script src="locale/zh-cn.js"></script> | ||
<script> | ||
date.locale('zh-cn'); // Chinese | ||
date.format(new Date(), 'MMMD日dddd'); // => '1月11日星期一' | ||
</script> | ||
``` | ||
Extends a current locale (formatter and parser). See [PLUGINS.md](./PLUGINS.md) for details. | ||
It supports the following languages for now: | ||
> Arabic (ar), Azerbaijani (az), Bengali (bn), Burmese (my), Chinese (zh-cn), Chinese (zh-tw), Czech (cs), Danish (dk), Dutch (nl), English (en), French (fr), German (de), Greek (el), Hindi (hi), Hungarian (hu), Indonesian (id), Italian (it), Japanese (ja), Javanese (jv), Korean (ko), Persian (fa), Polish (pl), Portuguese (pt), Punjabi (pa-in), Romanian (ro), Russian (ru), Serbian (sr), Spanish (es), Thai (th), Turkish (tr), Ukrainian (uk), Uzbek (uz), Vietnamese (vi) | ||
--- | ||
## Customizing | ||
If you have some problems with the default translation, you could change them as you want: | ||
### plugin(name[, extension]) | ||
*Plugin import or definition* | ||
- @param {**string**} name - plugin name | ||
- @param {**Object**} [extension] - locale definition | ||
- @returns {**void**} | ||
```javascript | ||
const now = new Date(); | ||
date.format(now, 'h:m A'); // => '12:34 p.m.' | ||
Plugin is a named locale definition defined with the `extend()`. See [PLUGINS.md](./PLUGINS.md) for details. | ||
date.setLocales('en', { | ||
A: ['AM', 'PM'] | ||
}); | ||
--- | ||
date.format(now, 'h:m A'); // => '12:34 PM' | ||
``` | ||
However, If **obviously** wrong, please send a PR or post the issue. | ||
## Browser Support | ||
@@ -503,0 +477,0 @@ Chrome, Firefox, Safari, Edge, and Internet Explorer 6+. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
104287
41
1769
1
0
469