From: Tim Wood Date: Wed, 11 Jan 2012 17:12:29 +0000 (-0800) Subject: Cleaning up docs and adding unit tests for #123 X-Git-Tag: 1.4.0~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbbfed53685f91e3ed6de51dc4cf140ce23b4f10;p=thirdparty%2Fmoment.git Cleaning up docs and adding unit tests for #123 --- diff --git a/site/docs/index.html b/site/docs/index.html index 352a3c8f4..cfa6d0024 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.3.03.2kb minified & gzippedDevelopment Version 1.3.021.8kb 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.3.03.2kb minified & gzippedDevelopment Version 1.3.021.8kb 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"
@@ -13,7 +13,7 @@ var dayWrapper = moment(day);
 

The parser ignores non-alphanumeric characters, so both moment("12-25-1995", "MM-DD-YYYY")and moment("12\25\1995", "MM-DD-YYYY")will return the same thing.

InputOutput
M or MMMonth Number (1 - 12)
M or MMMonth Name (In currently language set by moment.lang()) -
D or DDDay of month
DDD or DDDDDay of year
d, dd, ddd, or ddddDay of week (NOTE: these tokens are not used to create the date, as there are 4-5 weeks in a month, and it would be impossible to get the date based off the day of the week)
YY2 digit year (if greater than 70, will return 1900's, else 2000's)
YYYY4 digit year
a or AAM/PM
H, HH, h, or hh24 hour (for 12 hour time, use in conjunction with a or A)
m or mmMinutes
s or ssSeconds
Z or ZZTimezone offset as +0700 or +
D or DDDay of month
DDD or DDDDDay of year
d, dd, ddd, or ddddDay of week (NOTE: these tokens are not used to create the date, as there are 4-5 weeks in a month, and it would be impossible to get the date based off the day of the week)
YY2 digit year (if greater than 70, will return 1900's, else 2000's)
YYYY4 digit year
a or AAM/PM
H, HH24 hour time
h, or hh12 hour time (use in conjunction with a or A)
m or mmMinutes
s or ssSeconds
Z or ZZTimezone offset as +0700 or +07:30

Unless you specify a timezone offset, parsing a string will create a date in the current timezone.

A workaround to parse a string in UTC is to append "+0000" to the end of your input string, and add "ZZ"to the end of your format string.

Important:Parsing a string with a format is by far the slowest method of creating a date. @@ -250,7 +250,7 @@ moment(1316116057189).fromNow(); // il y a une heure (b === 2) ? 'nd' : (b === 3) ? 'rd' : 'th'; }; -

For more information on ordinal numbers, see wikipedia