From: Tim Wood Date: Tue, 6 Dec 2011 18:33:42 +0000 (-0800) Subject: Releasing version 1.2.0 X-Git-Tag: 1.2.0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11324f30af17ac9ec557c4aa8be2f5cc77fa16cd;p=thirdparty%2Fmoment.git Releasing version 1.2.0 --- diff --git a/build.js b/build.js index caea5a233..d746736b9 100755 --- a/build.js +++ b/build.js @@ -43,7 +43,7 @@ var LANG_MINIFY = "de en-gb es fr it kr nb nl pl pt ru sv".split(" "); var LANG_TEST = "de en en-gb es fr it kr nb nl pl pt ru sv".split(" "); var LANG_PREFIX = "(function() { var moment; if (typeof window === 'undefined') { moment = require('../../moment'); module = QUnit.module; } else { moment = window.moment; }"; var LANG_SUFFIX = "})();"; -var VERSION = '1.1.2'; +var VERSION = '1.2.0'; var MINIFY_COMMENT = '/* Moment.js | version : ' + VERSION + ' | author : Tim Wood | license : MIT */\n'; var MINSIZE = 0; var SRCSIZE = 0; diff --git a/moment.js b/moment.js index 1aa3a1220..31e203985 100644 --- a/moment.js +++ b/moment.js @@ -3,7 +3,7 @@ // (c) 2011 Tim Wood // Moment.js is freely distributable under the terms of the MIT license. // -// Version 1.1.2 +// Version 1.2.0 (function (Date, undefined) { @@ -13,7 +13,7 @@ hasModule = (typeof module !== 'undefined'), paramsToParse = 'months|monthsShort|weekdays|weekdaysShort|longDateFormat|relativeTime|ordinal|meridiem'.split('|'), i, - VERSION = "1.1.2", + VERSION = "1.2.0", shortcuts = 'Month|Date|Hours|Minutes|Seconds'.split('|'); // left zero fill a number diff --git a/moment.min.js b/moment.min.js index e570b3a3b..96e2c6ef7 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;m (http://timwoodcreates.com/)", diff --git a/site/docs/index.html b/site/docs/index.html index 76c304559..58f42fd2e 100644 --- a/site/docs/index.html +++ b/site/docs/index.html @@ -1,4 +1,4 @@ -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.js Documentation

Moment.js Documentation

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

Where to get it

Github

Production Version 1.2.02.8kb minified & gzippedDevelopment Version 1.2.020.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"
@@ -101,9 +101,8 @@ a.diff(b, 'years', true) // 1.5
 

moment().seconds() === new Date().getSeconds();

Minutes

moment().minutes(); // get the minutes

Hours

moment().hours(); // get the hours

Date

moment().date(); // get the date (0 - 31)

Day

moment().day(); // get the day (0 - 6)

Month

moment().month(); // get the month

Year

moment().year(); // get the year

Leap Year

moment.fn.isLeapYearreturns true if that year is a leap year, and false if it is not.

moment([2000]).isLeapYear() // true
 moment([2001]).isLeapYear() // false
-
 moment([2100]).isLeapYear() // false
-

Timezone Offset

moment().zone(); // get the timezone offset in minutes (60, 120, 240, etc.)

Daylight Savings Time

moment.fn.isLeapYear checks if the current moment is in daylight savings time or not. +

Timezone Offset

moment().zone(); // get the timezone offset in minutes (60, 120, 240, etc.)

Daylight Savings Time

moment.fn.isDST checks if the current moment is in daylight savings time or not.

moment([2011, 2, 12]).isDST(); // false, March 12 2011 is not DST
 moment([2011, 2, 14]).isDST(); // true, March 14 2011 is DST
 

I18N

Moment.js has pretty robust support for internationalization. You can load multiple languages onto the same instance and easily switch between them.

Changing languages

By default, Moment.js comes with English language strings. If you need other languages, you can load them into Moment.js for later use.

To load a language, pass the key and the string values to moment.lang. @@ -220,7 +219,7 @@ moment(1316116057189).fromNow(); // il y a une heure (b === 2) ? 'nd' : (b === 3) ? 'rd' : 'th'; }; -

For more information on ordinal numbers, see wikipedia