]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Updating to 0.6.1 0.6.1
authorTim Wood <washwithcare@gmail.com>
Tue, 11 Oct 2011 23:38:22 +0000 (16:38 -0700)
committerTim Wood <washwithcare@gmail.com>
Tue, 11 Oct 2011 23:38:22 +0000 (16:38 -0700)
Adding Portuguese, Italian, and French language support
Updating string arrays to use "Part_Part".split("_") instead of
["Part","Part"]

README.markdown
package.json
underscore.date.js
underscore.date.lang/fr.js [new file with mode: 0644]
underscore.date.lang/it.js
underscore.date.lang/pt.js
underscore.date.min.js

index e57938d256e6ed0ecf4df73b4a70e83bc835fdcc..dc8860a9bb8beae0a421b161fa2d3143ad1be888 100755 (executable)
@@ -5,7 +5,7 @@ Underscore.date is a javascript date library that helps create, manipulate, and
 
 Author: Tim Wood
 
-Version: 0.6.0
+Version: 0.6.1
 
 **Note:** There are some api changes that will break your code when upgrading from 0.4.1 to 0.5.0. Read about the changes in the changelog at the bottom of the page.
 
@@ -712,6 +712,10 @@ Underscore.date is freely distributable under the terms of the MIT license.
 Changelog
 =========
 
+### 0.6.1
+
+Added Portuguese, Italian, and French language support
+
 ### 0.6.0
 
 Added _date.lang() support.
index e5b29062df2fd9744f30871414a3e05a8ef55a3a..c06bfc78125c8080497514f6d8398c542ef7760d 100755 (executable)
@@ -1,6 +1,6 @@
 {
   "name": "underscore.date",
-  "version": "0.6.0",
+  "version": "0.6.1",
   "description": "Underscore.date is a javascript date library that helps create, manipulate, and format dates without extending the `Date` prototype.",
   "homepage": "https://github.com/timrwood/underscore.date",
   "author": "Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)",
index eef0d91805cc38e8fa9edb1c26c768450060dadb..c7c3c90716b2339172e9dfb5ea43f7d98936c96f 100644 (file)
@@ -3,7 +3,7 @@
 // (c) 2011 Tim Wood
 // Underscore.date is freely distributable under the terms of the MIT license.
 //
-// Version 0.6.0
+// Version 0.6.1
 
 (function (undefined) {
 
 
     // set default language
     _date.lang('en', {
-        months : ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
-        monthsShort : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
-        weekdays : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
-        weekdaysShort : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
+        months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
+        monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
+        weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
+        weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
         relativeTime : {
-            future: "in %s",
-            past: "%s ago",
-            s: "seconds",
-            m: "a minute",
-            mm: "%d minutes",
-            h: "an hour",
-            hh: "%d hours",
-            d: "a day",
-            dd: "%d days",
-            M: "a month",
-            MM: "%d months",
-            y: "a year",
-            yy: "%d years"
+            future : "in %s",
+            past : "%s ago",
+            s : "seconds",
+            m : "a minute",
+            mm : "%d minutes",
+            h : "an hour",
+            hh : "%d hours",
+            d : "a day",
+            dd : "%d days",
+            M : "a month",
+            MM : "%d months",
+            y : "a year",
+            yy : "%d years"
         },
         ordinal : function (number) {
             var b = number % 10;
diff --git a/underscore.date.lang/fr.js b/underscore.date.lang/fr.js
new file mode 100644 (file)
index 0000000..2a5b7f2
--- /dev/null
@@ -0,0 +1,37 @@
+(function () {
+    var lang = {
+            months : "Janvier_Février_Mars_Avril_Mai_Juin_Juillet_Aout_Septembre_Octobre_Novembre_Décembre".split("_"),
+            monthsShort : "Jan_Fev_Mar_Avr_Mai_Jui_Jui_Aou_Sep_Oct_Nov_Dec".split("_"),
+            weekdays : "Dimanche_Lundi_Mardi_Mercredi_Jeudi_Vendredi_Samedi".split("_"),
+            weekdaysShort : "Dim_Lun_Mar_Mer_Jeu_Ven_Sam".split("_"),
+            relativeTime : {
+                future : "in %s",
+                past : "il y a %s",
+                s : "secondes",
+                m : "une minute",
+                mm : "%d minutes",
+                h : "une heure",
+                hh : "%d heures",
+                d : "un jour",
+                dd : "%d jours",
+                M : "un mois",
+                MM : "%d mois",
+                y : "une année",
+                yy : "%d années"
+            },
+            ordinal : function(number) {
+                var b = num % 10;
+                return (~~ (number % 100 / 10) === 1) ? 'er' : 'ème';
+            }
+        },
+        abbr = 'fr';
+
+    // Node
+    if (typeof module !== 'undefined') {
+        module.exports = {lang : lang, abbr : abbr};
+    }
+    // Browser
+    if (typeof window !== 'undefined' && this._date && this._date.lang) {
+        this._date.lang(abbr, lang);
+    }
+}());
\ No newline at end of file
index 1eefecffcc1348a6fc4d6b5a9a65ebd9045a81a5..ad60e5fb83d28793e77b379ead46bba8c703b8b4 100644 (file)
@@ -1,28 +1,27 @@
 (function () {
     var lang = {
-          formatString: 'dddd DD MMMM YYYY HH:mm',
-          months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settebre", "Ottobre", "Novembre", "Dicembre"],
-          monthsShort: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"],
-          weekdays: ["Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato"],
-          weekdaysShort: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"],
-          relativeTime: {
-              future: "in %s",
-              past: "%s fa",
-              s: "secondi",
-              m: "un minuto",
-              mm: "%d minuti",
-              h: "un ora",
-              hh: "%d ore",
-              d: "un giorno",
-              dd: "%d giorni",
-              M: "un mese",
-              MM: "%d mesi",
-              y: "un anno",
-              yy: "%d anni"
-          },
-          ordinal: function () {
-              return 'º';
-          }
+            months : "Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settebre_Ottobre_Novembre_Dicembre".split("_"),
+            monthsShort : "Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),
+            weekdays : "Domenica_Lunedi_Martedi_Mercoledi_Giovedi_Venerdi_Sabato".split("_"),
+            weekdaysShort : "Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),
+            relativeTime : {
+                future : "in %s",
+                past : "%s fa",
+                s : "secondi",
+                m : "un minuto",
+                mm : "%d minuti",
+                h : "un ora",
+                hh : "%d ore",
+                d : "un giorno",
+                dd : "%d giorni",
+                M : "un mese",
+                MM : "%d mesi",
+                y : "un anno",
+                yy : "%d anni"
+            },
+            ordinal: function () {
+                return 'º';
+            }
         },
         abbr = 'it';
 
index 7d252574399902a5c2109cb9cced4d02fbcaf6d6..e25e4d7bd9a7e0a5c34b8eda177b5252e3514a51 100644 (file)
@@ -1,27 +1,27 @@
 (function () {
     var lang = {
-            months : ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
-            monthsShort : ["Jan", "Feb", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
-            weekdays : ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"],
-            weekdaysShort : ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"],
+            months : "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),
+            monthsShort : "Jan_Feb_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),
+            weekdays : "Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),
+            weekdaysShort : "Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),
             relativeTime : {
-                future: "em %s",
-                past: "%s atrás",
-                s: "segundos",
-                m: "um minuto",
-                mm: "%d minutos",
-                h: "uma hora",
-                hh: "%d horas",
-                d: "um dia",
-                dd: "%d dias",
-                M: "um mês",
-                MM: "%d meses",
-                y: "um ano",
-                yy: "%d anos"
+                future : "em %s",
+                past : "%s atrás",
+                s : "segundos",
+                m : "um minuto",
+                mm : "%d minutos",
+                h : "uma hora",
+                hh : "%d horas",
+                d : "um dia",
+                dd : "%d dias",
+                M : "um mês",
+                MM : "%d meses",
+                y : "um ano",
+                yy : "%d anos"
             },
             ordinal : function (number) {
                 return 'º';
-            },
+            }
         },
         abbr = 'pt';
 
index 9a287947234277b2df2ea70088b1619bfb167181..e12c73f7db7ce0c0c07f87ee2b13c867977094b5 100755 (executable)
@@ -3,6 +3,6 @@
 // (c) 2011 Tim Wood
 // Underscore.date is freely distributable under the terms of the MIT license.
 //
-// Version 0.6.0
+// Version 0.6.1
 
-(function(a){function f(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function g(a,b,c){var d=(b.ms||0)+(b.s||0)*1e3+(b.m||0)*6e4+(b.h||0)*36e5+(b.d||0)*864e5+(b.w||0)*6048e5,e=(b.M||0)+(b.y||0)*12,f;return d&&a.setMilliseconds(a.getMilliseconds()+d*c),e&&(f=a.getDate(),a.setDate(1),a.setMonth(a.getMonth()+e*c),a.setDate(Math.min((new Date(a.getFullYear(),a.getMonth()+1,0)).getDate(),f))),a}function h(a){return Object.prototype.toString.call(a)==="[object Array]"}function i(a){return new Date(a[0],a[1]||0,a[2]||1,a[3]||0,a[4]||0,a[5]||0,a[6]||0)}function j(a,c){function o(a){var c,m;switch(a){case"M":return d+1;case"Mo":return d+1+b.ordinal(d+1);case"MM":return f(d+1,2);case"MMM":return b.monthsShort[d];case"MMMM":return b.months[d];case"D":return e;case"Do":return e+b.ordinal(e);case"DD":return f(e,2);case"DDD":return c=new Date(g,d,e),m=new Date(g,0,1),~~((c-m)/864e5+1.5);case"DDDo":return c=o("DDD"),c+b.ordinal(c);case"DDDD":return f(o("DDD"),3);case"d":return h;case"do":return h+b.ordinal(h);case"ddd":return b.weekdaysShort[h];case"dddd":return b.weekdays[h];case"w":return c=new Date(g,d,e-h+5),m=new Date(c.getFullYear(),0,4),~~((c-m)/864e5/7+1.5);case"wo":return c=o("w"),c+b.ordinal(c);case"ww":return f(o("w"),2);case"YY":return(g+"").slice(-2);case"YYYY":return g;case"a":return i>11?"pm":"am";case"A":return i>11?"PM":"AM";case"H":return i;case"HH":return f(i,2);case"h":return i%12||12;case"hh":return f(i%12||12,2);case"m":return j;case"mm":return f(j,2);case"s":return k;case"ss":return f(k,2);case"zz":case"z":c=l.indexOf("(");if(c>-1)return l.slice(c+1,l.indexOf(")")).replace(n,"");return l.slice(l.indexOf(":")).replace(n,"");default:return a.replace("\\","")}}var d=a.getMonth(),e=a.getDate(),g=a.getFullYear(),h=a.getDay(),i=a.getHours(),j=a.getMinutes(),k=a.getSeconds(),l=a.toString(),m=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?)/g,n=/[^A-Z]/g;return c.replace(m,o)}function k(a,b){function j(a,b){switch(a){case"M":case"MM":c[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":c[2]=~~b;break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~b;break;case"a":case"A":h=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b}}var c=[0],d=/[0-9a-zA-Z]+/g,e=a.match(d),f=b.match(d),g,h;for(g=0;g<f.length;g++)j(f[g],e[g]);return h&&c[3]<12&&(c[3]+=12),i(c)}function l(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function m(a,b){var c,d=/[0-9a-zA-Z]+/g,e=a.match(d),f=[],g=99,h,i,m;for(h=0;h<b.length;h++)i=k(a,b[h]),m=l(e,j(i,b[h]).match(d)),m<g&&(g=m,c=i);return c}function n(b,c){b&&b.date instanceof Date?this.date=b.date:c?h(c)?this.date=m(b,c):this.date=k(b,c):this.date=b===a?new Date:b instanceof Date?b:h(b)?i(b):new Date(b)}function o(a){return isNaN(a)?(new n(a)).date.getTime():a}function p(a,c){return b.relativeTime[a].replace(/%d/i,c||1)}function q(a,b){return o(a)-o(b)}function r(a){var b=Math.abs(a)/1e3,d=b/60,e=d/60,f=e/24,g=f/365;return b<45&&p("s",c(b))||c(d)===1&&p("m")||d<45&&p("mm",c(d))||c(e)===1&&p("h")||e<22&&p("hh",c(e))||c(f)===1&&p("d")||f<25&&p("dd",c(f))||f<45&&p("M")||f<345&&p("MM",c(f/30))||c(g)===1&&p("y")||p("yy",c(g))}var b,c=Math.round,d={},e="months|monthsShort|weekdays|weekdaysShort|relativeTime|ordinal".split("|");b=function(a,b){return new n(a,b)},b.lang=function(a,c){var f,g;c&&(d[a]=c);if(d[a])for(f=0;f<e.length;f++)g=e[f],b[g]=d[a][g]||b[g]},b.lang("en",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],relativeTime:{future:"in %s",past:"%s ago",s:"seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),n.prototype={valueOf:function(){return this.date.getTime()},format:function(a){return j(this.date,a)},add:function(a){return this.date=g(this.date,a,1),this},subtract:function(a){return this.date=g(this.date,a,-1),this},from:function(a,c,d){var e=q(this.date,a),f=e<0?b.relativeTime.past:b.relativeTime.future;return d?e:c?r(e):f.replace(/%s/i,r(e))},fromNow:function(a,b){return this.from(new n,a,b)},isLeapYear:function(){var a=this.date.getFullYear();return a%4===0&&a%100!==0||a%400===0}},typeof window=="undefined"&&typeof module!="undefined"?module.exports=b:(this._!==a&&this._.mixin!==a&&this._.mixin({date:b}),this._date=b)})()
\ No newline at end of file
+(function(a){function f(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function g(a,b,c){var d=(b.ms||0)+(b.s||0)*1e3+(b.m||0)*6e4+(b.h||0)*36e5+(b.d||0)*864e5+(b.w||0)*6048e5,e=(b.M||0)+(b.y||0)*12,f;return d&&a.setMilliseconds(a.getMilliseconds()+d*c),e&&(f=a.getDate(),a.setDate(1),a.setMonth(a.getMonth()+e*c),a.setDate(Math.min((new Date(a.getFullYear(),a.getMonth()+1,0)).getDate(),f))),a}function h(a){return Object.prototype.toString.call(a)==="[object Array]"}function i(a){return new Date(a[0],a[1]||0,a[2]||1,a[3]||0,a[4]||0,a[5]||0,a[6]||0)}function j(a,c){function o(c){var l,p;switch(c){case"M":return d+1;case"Mo":return d+1+b.ordinal(d+1);case"MM":return f(d+1,2);case"MMM":return b.monthsShort[d];case"MMMM":return b.months[d];case"D":return e;case"Do":return e+b.ordinal(e);case"DD":return f(e,2);case"DDD":return l=new Date(g,d,e),p=new Date(g,0,1),~~((l-p)/864e5+1.5);case"DDDo":return l=o("DDD"),l+b.ordinal(l);case"DDDD":return f(o("DDD"),3);case"d":return h;case"do":return h+b.ordinal(h);case"ddd":return b.weekdaysShort[h];case"dddd":return b.weekdays[h];case"w":return l=new Date(g,d,e-h+5),p=new Date(l.getFullYear(),0,4),~~((l-p)/864e5/7+1.5);case"wo":return l=o("w"),l+b.ordinal(l);case"ww":return f(o("w"),2);case"YY":return(g+"").slice(-2);case"YYYY":return g;case"a":return i>11?"pm":"am";case"A":return i>11?"PM":"AM";case"H":return i;case"HH":return f(i,2);case"h":return i%12||12;case"hh":return f(i%12||12,2);case"m":return j;case"mm":return f(j,2);case"s":return k;case"ss":return f(k,2);case"zz":case"z":return(a.toString().match(n)||[""])[0].replace(m,"");default:return c.replace("\\","")}}var d=a.getMonth(),e=a.getDate(),g=a.getFullYear(),h=a.getDay(),i=a.getHours(),j=a.getMinutes(),k=a.getSeconds(),l=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?)/g,m=/[^A-Z]/g,n=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g;return c.replace(l,o)}function k(a,b){function j(a,b){switch(a){case"M":case"MM":c[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":c[2]=~~b;break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~b;break;case"a":case"A":h=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b}}var c=[0],d=/[0-9a-zA-Z]+/g,e=a.match(d),f=b.match(d),g,h;for(g=0;g<f.length;g++)j(f[g],e[g]);return h&&c[3]<12&&(c[3]+=12),i(c)}function l(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function m(a,b){var c,d=/[0-9a-zA-Z]+/g,e=a.match(d),f=[],g=99,h,i,m;for(h=0;h<b.length;h++)i=k(a,b[h]),m=l(e,j(i,b[h]).match(d)),m<g&&(g=m,c=i);return c}function n(b,c){b&&b.date instanceof Date?this.date=b.date:c?h(c)?this.date=m(b,c):this.date=k(b,c):this.date=b===a?new Date:b instanceof Date?b:h(b)?i(b):new Date(b)}function o(a){return isNaN(a)?(new n(a)).date.getTime():a}function p(a,c){return b.relativeTime[a].replace(/%d/i,c||1)}function q(a,b){return o(a)-o(b)}function r(a){var b=Math.abs(a)/1e3,d=b/60,e=d/60,f=e/24,g=f/365;return b<45&&p("s",c(b))||c(d)===1&&p("m")||d<45&&p("mm",c(d))||c(e)===1&&p("h")||e<22&&p("hh",c(e))||c(f)===1&&p("d")||f<25&&p("dd",c(f))||f<45&&p("M")||f<345&&p("MM",c(f/30))||c(g)===1&&p("y")||p("yy",c(g))}var b,c=Math.round,d={},e="months|monthsShort|weekdays|weekdaysShort|relativeTime|ordinal".split("|");b=function(a,b){return new n(a,b)},b.lang=function(a,c){var f,g;c&&(d[a]=c);if(d[a])for(f=0;f<e.length;f++)g=e[f],b[g]=d[a][g]||b[g]},b.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),relativeTime:{future:"in %s",past:"%s ago",s:"seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),n.prototype={valueOf:function(){return this.date.getTime()},format:function(a){return j(this.date,a)},add:function(a){return this.date=g(this.date,a,1),this},subtract:function(a){return this.date=g(this.date,a,-1),this},from:function(a,c,d){var e=q(this.date,a),f=e<0?b.relativeTime.past:b.relativeTime.future;return d?e:c?r(e):f.replace(/%s/i,r(e))},fromNow:function(a,b){return this.from(new n,a,b)},isLeapYear:function(){var a=this.date.getFullYear();return a%4===0&&a%100!==0||a%400===0}},typeof window=="undefined"&&typeof module!="undefined"?module.exports=b:(this._!==a&&this._.mixin!==a&&this._.mixin({date:b}),this._date=b)})()
\ No newline at end of file