From: Tim Wood Date: Thu, 1 Dec 2011 21:41:08 +0000 (-0800) Subject: Build for #78 X-Git-Tag: 1.2.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c35a0ca3a281efad6e814db23d28a313c9e7b89;p=thirdparty%2Fmoment.git Build for #78 --- diff --git a/moment.min.js b/moment.min.js index b5c41f37e..e570b3a3b 100755 --- a/moment.min.js +++ b/moment.min.js @@ -1,2 +1,2 @@ /* Moment.js | version : 1.1.2 | author : Tim Wood | license : MIT */ -(function(a,b){function k(a,b){var c=a+"";while(c.length11?s.pm:s.am;case"A":return i>11?s.PM:s.AM;case"H":return i;case"HH":return k(i,2);case"h":return i%12||12;case"hh":return k(i%12||12,2);case"m":return j;case"mm":return k(j,2);case"s":return l;case"ss":return k(l,2);case"zz":case"z":return(b.toString().match(q)||[""])[0].replace(p,"");case"Z":return(m>0?"+":"-")+k(~~(m/60),2)+":"+k(~~(m%60),2);case"ZZ":return(m>0?"+":"-")+k(~~(10*m/6),4);case"L":case"LL":case"LLL":case"LLLL":return o(b,c.longDateFormat[d]);default:return d.replace("\\","")}}var e=b.getMonth(),f=b.getDate(),g=b.getFullYear(),h=b.getDay(),i=b.getHours(),j=b.getMinutes(),l=b.getSeconds(),m=b.getTimezoneOffset(),n=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|ZZ?|LL?L?L?)/g,p=/[^A-Z]/g,q=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,r=c.ordinal,s=c.meridiem;return d.replace(n,t)}function p(b,c){function p(a,b){var c;switch(a){case"M":case"MM":d[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":d[2]=~~b;break;case"YY":b=~~b,d[0]=b+(b>70?1900:2e3);break;case"YYYY":d[0]=~~Math.abs(b);break;case"a":case"A":o=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":d[3]=~~b;break;case"m":case"mm":d[4]=~~b;break;case"s":case"ss":d[5]=~~b;break;case"Z":case"ZZ":g=!0,c=b.match(j),c[1]&&(e=~~c[1]),c[2]&&(f=~~c[2]),c[0]==="-"&&(e=-e,f=-f)}}var d=[0,0,1,0,0,0,0],e=0,f=0,g=!1,h=/(\\)?(MM?|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|ZZ?)/g,i=/(\\)?([0-9]+|am|pm|([\+\-]\d\d:?\d\d))/gi,j=/([\+\-]|\d\d)/gi,k=b.match(i),l=c.match(h),m,o;for(m=0;m11?s.pm:s.am;case"A":return i>11?s.PM:s.AM;case"H":return i;case"HH":return k(i,2);case"h":return i%12||12;case"hh":return k(i%12||12,2);case"m":return j;case"mm":return k(j,2);case"s":return l;case"ss":return k(l,2);case"zz":case"z":return(b.toString().match(q)||[""])[0].replace(p,"");case"Z":return(m>0?"+":"-")+k(~~(m/60),2)+":"+k(~~(m%60),2);case"ZZ":return(m>0?"+":"-")+k(~~(10*m/6),4);case"L":case"LL":case"LLL":case"LLLL":return o(b,c.longDateFormat[d]);default:return d.replace("\\","")}}var e=b.getMonth(),f=b.getDate(),g=b.getFullYear(),h=b.getDay(),i=b.getHours(),j=b.getMinutes(),l=b.getSeconds(),m=b.getTimezoneOffset(),n=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|ZZ?|LL?L?L?)/g,p=/[^A-Z]/g,q=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,r=c.ordinal,s=c.meridiem;return d.replace(n,t)}function p(b,c){function p(a,b){var c;switch(a){case"M":case"MM":d[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":d[2]=~~b;break;case"YY":b=~~b,d[0]=b+(b>70?1900:2e3);break;case"YYYY":d[0]=~~Math.abs(b);break;case"a":case"A":o=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":d[3]=~~b;break;case"m":case"mm":d[4]=~~b;break;case"s":case"ss":d[5]=~~b;break;case"Z":case"ZZ":g=!0,c=b.match(j),c[1]&&(e=~~c[1]),c[2]&&(f=~~c[2]),c[0]==="-"&&(e=-e,f=-f)}}var d=[0,0,1,0,0,0,0],e=0,f=0,g=!1,h=/(\\)?(MM?|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|ZZ?)/g,i=/(\\)?([0-9]+|am|pm|([\+\-]\d\d:?\d\d))/gi,j=/([\+\-]|\d\d)/gi,k=b.match(i),l=c.match(h),m,o;for(m=0;mMoment.js Documentation

Moment.js Documentation

A lightweight javascript date library for parsing, manipulating, and formatting dates.

Where to get it

Github

Production Version 1.1.22.8kb minified & gzippedDevelopment Version 1.1.220.1kb full source + comments

You can also clone the project with Git by running:

git clone git://github.com/timrwood/moment

npm

npm install moment

Where to use it

Moment was designed to work in both the browser and in NodeJS. All code will work in both environments. All unit tests are run in both environments.

In NodeJS

var moment = require('moment');
+Moment.js Documentation

Moment.js Documentation

A lightweight javascript date library for parsing, manipulating, and formatting dates.

Where to get it

Github

Production Version 1.1.22.8kb minified & gzippedDevelopment Version 1.1.220.1kb full source + comments

You can also clone the project with Git by running:

git clone git://github.com/timrwood/moment

npm

npm install moment

Where to use it

Moment was designed to work in both the browser and in NodeJS. All code will work in both environments. All unit tests are run in both environments.

In NodeJS

var moment = require('moment');
 moment().add('hours', 1).fromNow(); // "1 hour ago"
 

In the browser

<script src="moment.min.js"></script>
 moment().add('hours', 1).fromNow(); // "1 hour ago"
@@ -35,6 +35,13 @@ moment().add('days', 360); // 360 days
 

Special considerations for months and years

If the day of the month on the original date is greater than the number of days in the final month, the day of the month will change to the last day in the final month.

Example:

moment([2010, 0, 31]);                  // January 31 
 moment([2010, 0, 31]).add('months', 1); // February 28
+

There are also special considerations to keep in mind when adding time that crosses over Daylight Savings Time.If you are adding years, months, weeks, or days, the original hour will always match the added hour. +

var m = moment(new Date(2011, 2, 12, 5, 0, 0)); // the day before DST in the US
+m.hours(); // 5
+m.add('days', 1).hours(); // 5
+

If you are adding hours, minutes, seconds, or milliseconds, the assumption is that you want precision to the hour, and will result in a different hour.

var m = moment(new Date(2011, 2, 12, 5, 0, 0)); // the day before DST in the US
+m.hours(); // 5
+m.add('hours', 24).hours(); // 6
 

Subtracting Time

This is exactly the same as moment.fn.add, only instead of adding time, it subtracts time.

moment().subtract('days', 7);

Seconds

There are a number of shortcut getter and setter functions. Much like in jQuery, calling the function without paremeters causes it to function as a getter, and calling with a parameter causes it to function as a setter. @@ -136,14 +143,14 @@ moment([2011, 2, 14]).isDST(); // true, March 14 2011 is DST } });

Once you load a language, it becomes the active language. To change active languages, simply call moment.langwith the key of a loaded language. -

moment.lang('fr');moment(1316116057189).fromNow() // il y a une heure
+

moment.lang('fr');
+moment(1316116057189).fromNow() // il y a une heure
 moment.lang('en');
 moment(1316116057189).fromNow() // an hour ago
 

Loading languages in NodeJS

Loading languages in NodeJS is super easy. If there is a language file in moment/lang/named after that key, the first call to moment.langwill load it.

var moment = require('moment');
 moment.lang('fr');
-
 moment(1316116057189).fromNow(); // il y a une heure
 

Right now, there is only support for English, French, Italian, and Portuguese. If you want your language supported, create a pull request or send me an email with the required files. @@ -211,7 +218,7 @@ moment(1316116057189).fromNow(); // il y a une heure (b === 2) ? 'nd' : (b === 3) ? 'rd' : 'th'; }; -

For more information on ordinal numbers, see wikipedia