]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Building docs
authorTim Wood <washwithcare@gmail.com>
Fri, 3 Feb 2012 18:44:42 +0000 (10:44 -0800)
committerTim Wood <washwithcare@gmail.com>
Fri, 3 Feb 2012 18:44:42 +0000 (10:44 -0800)
#156 #154 #148 #133

site/docs/index.html
site/js/moment.js

index 31260c0f396af75e8ffdcb6e222a6b2e79c5297e..368efa1c99dab897b20ff2db65de30ca0894d09b 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html><html><head><meta charset="utf-8"><link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"><link rel="stylesheet" href="../css/style.css?_=nocachebuster"><title>Moment.js Documentation</title></head><body><div id="navwrap"><div id="nav"><h1>Moment.js</h1><ul><li><a href="/" class="btn clean-gray">Home</a></li><li><a href="/docs/" class="btn clean-gray">Documentation</a></li><li><a href="/test/" class="btn clean-gray">Unit Tests</a></li><li><a href="https://github.com/timrwood/moment" class="btn clean-gray">Github</a></li></ul></div></div><div id="content"><div id="docnav"><h2><a href="#/get-it"><span>Get it</span></a></h2><ul><li><a href="#/get-it/github">Github</a></li><li><a href="#/get-it/npm">npm</a></li></ul><h2><a href="#/use-it"><span>Use it</span></a></h2><ul><li><a href="#/use-it/node">In NodeJS</a></li><li><a href="#/use-it/browser">In the browser</a></li></ul><h2><a href="#/parsing"><span>Parsing</span></a></h2><ul><li><a href="#/parsing/date">Javascript Date Object</a></li><li><a href="#/parsing/unix">Unix Timestamp</a></li><li><a href="#/parsing/string">String</a></li><li><a href="#/parsing/string+format">String + Format</a></li><li><a href="#/parsing/string+formats">String + Formats</a></li><li><a href="#/parsing/now">Now</a></li><li><a href="#/parsing/array">Javascript Array</a></li></ul><h2><a href="#/manipulation"><span>Manipulation</span></a></h2><ul><li><a href="#/manipulation/add">Add</a></li><li><a href="#/manipulation/subtract">Subtract</a></li><li><a href="#/manipulation/milliseconds">Milliseconds</a></li><li><a href="#/manipulation/seconds">Seconds</a></li><li><a href="#/manipulation/minutes">Minutes</a></li><li><a href="#/manipulation/hours">Hours</a></li><li><a href="#/manipulation/date">Date</a></li><li><a href="#/manipulation/day">Day</a></li><li><a href="#/manipulation/month">Month</a></li><li><a href="#/manipulation/year">Year</a></li><li><a href="#/manipulation/sod">Start of Day</a></li><li><a href="#/manipulation/eod">End of Day</a></li></ul><h2><a href="#/display"><span>Display</span></a></h2><ul><li><a href="#/display/format">Formatted date</a></li><li><a href="#/display/from">Time from another moment</a></li><li><a href="#/display/fromNow">Time from now</a></li><li><a href="#/display/calendar">Calendar time</a></li><li><a href="#/display/diff">Difference</a></li><li><a href="#/display/native">Native Date</a></li><li><a href="#/display/valueOf">Value</a></li><li><a href="#/display/milliseconds">Milliseconds</a></li><li><a href="#/display/seconds">Seconds</a></li><li><a href="#/display/minutes">Minutes</a></li><li><a href="#/display/hours">Hours</a></li><li><a href="#/display/date">Date</a></li><li><a href="#/display/day">Day</a></li><li><a href="#/display/month">Month</a></li><li><a href="#/display/year">Year</a></li><li><a href="#/display/leapyear">Leap Year</a></li><li><a href="#/display/zone">Timezone Offset</a></li><li><a href="#/display/dst">Daylight Savings Time</a></li></ul><h2><a href="#/i18n"><span>I18N</span></a></h2><ul><li><a href="#/i18n/lang">Changing languages</a></li><li><a href="#/i18n/node">Loading languages in NodeJS</a></li><li><a href="#/i18n/browser">Loading languages in the browser</a></li><li><a href="#/i18n/add">Adding your language to Moment.js</a></li></ul><h2><a href="#/custom"><span>Customization</span></a></h2><ul><li><a href="#/custom/months">Month Names</a></li><li><a href="#/custom/monthsShort">Month Abbreviations</a></li><li><a href="#/custom/weekdays">Weekday Names</a></li><li><a href="#/custom/weekdaysShort">Weekday Abbreviations</a></li><li><a href="#/custom/longDateFormats">Long Date Formats</a></li><li><a href="#/custom/relativeTime">Relative Time</a></li><li><a href="#/custom/meridiem">AM/PM</a></li><li><a href="#/custom/calendar">Calendar</a></li><li><a href="#/custom/ordinal">Ordinal</a></li></ul></div><div id="docs"><h1>Moment.js Documentation</h1><p>A lightweight javascript date library for parsing, manipulating, and formatting dates.</p><a name="/get-it"></a><h2><span>Where to get it</span></h2><a name="/get-it/github"></a><h3><span>Github</span></h3><a href="https://raw.github.com/timrwood/moment/1.3.0/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.3.0</span><span class="filesize">3.3kb minified &amp; gzipped</span></a><a href="https://raw.github.com/timrwood/moment/1.3.0/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.3.0</span><span class="filesize">22.5kb full source + comments</span></a><p>You can also clone the project with Git by running:</p><pre>git clone git://github.com/timrwood/moment</pre><a name="/get-it/npm"></a><h3><span>npm</span></h3><pre>npm install moment</pre><a name="/use-it"></a><h2><span>Where to use it</span></h2><p>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.</p><a name="/use-it/node"></a><h3><span>In NodeJS</span></h3><pre>var moment = require('moment');
+<!DOCTYPE html><html><head><meta charset="utf-8"><link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"><link rel="stylesheet" href="../css/style.css?_=nocachebuster"><title>Moment.js Documentation</title></head><body><div id="navwrap"><div id="nav"><h1>Moment.js</h1><ul><li><a href="/" class="btn clean-gray">Home</a></li><li><a href="/docs/" class="btn clean-gray">Documentation</a></li><li><a href="/test/" class="btn clean-gray">Unit Tests</a></li><li><a href="https://github.com/timrwood/moment" class="btn clean-gray">Github</a></li></ul></div></div><div id="content"><div id="docnav"><h2><a href="#/get-it"><span>Get it</span></a></h2><ul><li><a href="#/get-it/github">Github</a></li><li><a href="#/get-it/npm">npm</a></li></ul><h2><a href="#/use-it"><span>Use it</span></a></h2><ul><li><a href="#/use-it/node">In NodeJS</a></li><li><a href="#/use-it/browser">In the browser</a></li></ul><h2><a href="#/parsing"><span>Parsing</span></a></h2><ul><li><a href="#/parsing/date">Javascript Date Object</a></li><li><a href="#/parsing/unix">Unix Timestamp</a></li><li><a href="#/parsing/string">String</a></li><li><a href="#/parsing/string+format">String + Format</a></li><li><a href="#/parsing/string+formats">String + Formats</a></li><li><a href="#/parsing/now">Now</a></li><li><a href="#/parsing/array">Javascript Array</a></li><li><a href="#/parsing/asp-net">ASP.NET json dates</a></li><li><a href="#/parsing/clone">Cloning</a></li></ul><h2><a href="#/manipulation"><span>Manipulation</span></a></h2><ul><li><a href="#/manipulation/add">Add</a></li><li><a href="#/manipulation/subtract">Subtract</a></li><li><a href="#/manipulation/milliseconds">Milliseconds</a></li><li><a href="#/manipulation/seconds">Seconds</a></li><li><a href="#/manipulation/minutes">Minutes</a></li><li><a href="#/manipulation/hours">Hours</a></li><li><a href="#/manipulation/date">Date</a></li><li><a href="#/manipulation/day">Day</a></li><li><a href="#/manipulation/month">Month</a></li><li><a href="#/manipulation/year">Year</a></li><li><a href="#/manipulation/sod">Start of Day</a></li><li><a href="#/manipulation/eod">End of Day</a></li></ul><h2><a href="#/display"><span>Display</span></a></h2><ul><li><a href="#/display/format">Formatted date</a></li><li><a href="#/display/from">Time from another moment</a></li><li><a href="#/display/fromNow">Time from now</a></li><li><a href="#/display/calendar">Calendar time</a></li><li><a href="#/display/diff">Difference</a></li><li><a href="#/display/toDate">Native Javascript Date</a></li><li><a href="#/display/valueOf">Value</a></li><li><a href="#/display/milliseconds">Milliseconds</a></li><li><a href="#/display/seconds">Seconds</a></li><li><a href="#/display/minutes">Minutes</a></li><li><a href="#/display/hours">Hours</a></li><li><a href="#/display/date">Date</a></li><li><a href="#/display/day">Day</a></li><li><a href="#/display/month">Month</a></li><li><a href="#/display/year">Year</a></li><li><a href="#/display/leapyear">Leap Year</a></li><li><a href="#/display/zone">Timezone Offset</a></li><li><a href="#/display/dst">Daylight Savings Time</a></li></ul><h2><a href="#/i18n"><span>I18N</span></a></h2><ul><li><a href="#/i18n/lang">Changing languages</a></li><li><a href="#/i18n/node">Loading languages in NodeJS</a></li><li><a href="#/i18n/browser">Loading languages in the browser</a></li><li><a href="#/i18n/add">Adding your language to Moment.js</a></li></ul><h2><a href="#/custom"><span>Customization</span></a></h2><ul><li><a href="#/custom/months">Month Names</a></li><li><a href="#/custom/monthsShort">Month Abbreviations</a></li><li><a href="#/custom/weekdays">Weekday Names</a></li><li><a href="#/custom/weekdaysShort">Weekday Abbreviations</a></li><li><a href="#/custom/longDateFormats">Long Date Formats</a></li><li><a href="#/custom/relativeTime">Relative Time</a></li><li><a href="#/custom/meridiem">AM/PM</a></li><li><a href="#/custom/calendar">Calendar</a></li><li><a href="#/custom/ordinal">Ordinal</a></li></ul><h2><a href="#/plugins"><span>Plugins</span></a></h2><ul><li><a href="#/plugins/strftime">strftime</a></li></ul></div><div id="docs"><h1>Moment.js Documentation</h1><p>A lightweight javascript date library for parsing, manipulating, and formatting dates.</p><a name="/get-it"></a><h2><span>Where to get it</span></h2><a name="/get-it/github"></a><h3><span>Github</span></h3><a href="https://raw.github.com/timrwood/moment/1.3.0/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.3.0</span><span class="filesize">3.3kb minified &amp; gzipped</span></a><a href="https://raw.github.com/timrwood/moment/1.3.0/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.3.0</span><span class="filesize">22.5kb full source + comments</span></a><p>You can also clone the project with Git by running:</p><pre>git clone git://github.com/timrwood/moment</pre><a name="/get-it/npm"></a><h3><span>npm</span></h3><pre>npm install moment</pre><a name="/use-it"></a><h2><span>Where to use it</span></h2><p>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.</p><a name="/use-it/node"></a><h3><span>In NodeJS</span></h3><pre>var moment = require('moment');
 moment().add('hours', 1).fromNow(); // &quot;1 hour ago&quot;
 </pre><a name="/use-it/browser"></a><h3><span>In the browser</span></h3><pre>&lt;script src="moment.min.js">&lt;/script>
 moment().add('hours', 1).fromNow(); // &quot;1 hour ago&quot;
@@ -28,8 +28,20 @@ var day = moment([2010, 6]); // July 1st
 var day = moment([2010, 6, 10]); // July 10th
 </pre><p>Construction with an array will create a date in the current timezone. To create a date from an array at UTC, you can use the following.</p><pre>var array = [2010, 1, 14, 15, 25, 50, 125];
 var day = moment(Date.UTC.apply({}, array));
-</pre><a name="/manipulation"></a><h2><span>Manipulation</span></h2><p>Once you have a Moment.js wrapper object, you may want to manipulate it in some way. There are a number of <code>moment.fn</code>methods to help with this.
-</p><p>All manipulation methods are chainable, so you can do crazy things like this.</p><pre>moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).seconds(0);</pre><a name="/manipulation/add"></a><h3><span>Adding Time</span></h3><p>This is a pretty robust function for adding time to an existing date. To add time, pass the key of what time you want to add, and the amount you want to add.
+</pre><a name="/parsing/asp-net"></a><h3><span>ASP.NET style json dates</span></h3><p>ASP.NET returns dates in json in the following formats. <code>/Date(1198908717056)/</code> or 
+<code>/Date(1198908717056-0700)/</code></p><p>If a string that matches this format is passed in, it will be parsed correctly.</p><pre>moment("/Date(1198908717056-0700)/").valueOf(); // 1198908717056</pre><a name="/parsing/clone"></a><h3><span>Cloning</span></h3><p>All moments are mutable. If you want a clone of a moment, you can do so explicitly or implicitly.</p><p>Calling <code>moment()</code> on a moment will clone it.
+</p><pre>var a = moment([2012]);
+var b = moment(a);
+a.year(2000);
+b.year(); // 2012
+</pre><p>Additionally, you can call <code>moment.fn.clone</code> to clone a moment.
+</p><pre>var a = moment([2012]);
+var b = a.clone();
+a.year(2000);
+b.year(); // 2012
+</pre><a name="/manipulation"></a><h2><span>Manipulation</span></h2><p>Once you have a Moment.js wrapper object, you may want to manipulate it in some way. There are a number of <code>moment.fn</code> methods to help with this.
+</p><p>All manipulation methods are chainable, so you can do crazy things like this.</p><pre>moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).seconds(0);</pre><p>It should be noted that moments are mutable. Calling any of the manipulation methods will change the original moment.</p><p>If you want to create a copy and manipulate it, you should use <code>moment.fn.clone</code> before manipulating the moment. 
+<a href="#/parsing/clone">More info on cloning.</a></p><a name="/manipulation/add"></a><h3><span>Adding Time</span></h3><p>This is a pretty robust function for adding time to an existing date. To add time, pass the key of what time you want to add, and the amount you want to add.
 </p><pre>moment().add('days', 7);</pre><p>There are some shorthand keys as well if you're into that whole brevity thing.</p><pre>moment().add('d', 7);</pre><table><tbody><tr><th>Key</th><th>Shorthand</th></tr><tr><td>years</td><td>y</td></tr><tr><td>months</td><td>M</td></tr><tr><td>weeks</td><td>w</td></tr><tr><td>days</td><td>d</td></tr><tr><td>hours</td><td>h</td></tr><tr><td>minutes</td><td>m</td></tr><tr><td>seconds</td><td>s</td></tr><tr><td>milliseconds</td><td>ms</td></tr></tbody></table><p>If you want to add multiple different keys at the same time, you can pass them in as an object literal.</p><pre>moment().add('days', 7).add('months', 1); // with chaining 
 moment().add({days:7,months:1}); // with object literal
 </pre><p>There are no upper limits for the amounts, so you can overload any of the parameters.</p><pre>moment().add('milliseconds', 1000000); // a million milliseconds 
@@ -57,13 +69,14 @@ moment().milliseconds() === new Date().getMilliseconds();
 moment().day(7); // set to next Sunday (0 + 7)
 moment().day(10); // set to next Wednesday (3 + 7)
 moment().day(24); // set to 3 Wednesdays from now (3 + 7 + 7 + 7)
-</pre><a name="/manipulation/month"></a><h3><span>Month</span></h3><p>Accepts numbers from 0 to 11</p><pre>moment().month(5); // set the month to June</pre><a name="/manipulation/year"></a><h3><span>Year</span></h3><pre>moment().year(1984); // set the year to 1984</pre><a name="/manipulation/sod"></a><h3><span>Start of Day</span></h3><pre>moment().sod(); // set the time to last midnight</pre><a name="/manipulation/eod"></a><h3><span>End of Day</span></h3><pre>moment().eod(); // set the time to 11:59:59.999 pm tonight</pre><a name="/display"></a><h2><span>Display</span></h2><p>Once parsing and manipulation are done, you need some way to display the moment. Moment.js offers many ways of doing that.</p><a name="/display/format"></a><h3><span>Formatted Date</span></h3><p>The most robust display option is <code>moment.fn.format</code>. It takes a string of tokens and replaces them with their corresponding values from the Date object.
+</pre><a name="/manipulation/month"></a><h3><span>Month</span></h3><p>Accepts numbers from 0 to 11</p><pre>moment().month(5); // set the month to June</pre><a name="/manipulation/year"></a><h3><span>Year</span></h3><pre>moment().year(1984); // set the year to 1984</pre><a name="/manipulation/sod"></a><h3><span>Start of Day</span></h3><pre>moment().sod(); // set the time to last midnight</pre><p>This is essentially the same as the following.</p><pre>moment().hours(0).minutes(0).seconds(0).milliseconds(0);</pre><a name="/manipulation/eod"></a><h3><span>End of Day</span></h3><pre>moment().eod(); // set the time to 11:59:59.999 pm tonight</pre><p>This is essentially the same as the following.</p><pre>moment().hours(23).minutes(59).seconds(59).milliseconds(999);</pre><a name="/display"></a><h2><span>Display</span></h2><p>Once parsing and manipulation are done, you need some way to display the moment. Moment.js offers many ways of doing that.</p><a name="/display/format"></a><h3><span>Formatted Date</span></h3><p>The most robust display option is <code>moment.fn.format</code>. It takes a string of tokens and replaces them with their corresponding values from the Date object.
 </p><pre>var date = new Date(2010, 1, 14, 15, 25, 50, 125);
 moment(date).format(&quot;dddd, MMMM Do YYYY, h:mm:ss a&quot;); // &quot;Sunday, February 14th 2010, 3:25:50 pm&quot;
 moment(date).format(&quot;ddd, hA&quot;);                       // &quot;Sun, 3PM&quot;
 </pre><table><tbody><tr><th>Token</th><th>Output</th></tr><tr><td><b>Month</b></td><td></td></tr><tr><td>M</td><td>1 2 ... 11 12</td></tr><tr><td>Mo</td><td>1st 2nd ... 11th 12th</td></tr><tr><td>MM</td><td>01 02 ... 11 12</td></tr><tr><td>MMM</td><td>Jan Feb ... Nov Dec</td></tr><tr><td>MMMM</td><td>January February ... November December</td></tr><tr><td><b>Day of Month</b></td><td></td></tr><tr><td>D</td><td>1 2 ... 30 30</td></tr><tr><td>Do</td><td>1st 2nd ... 30th 31st</td></tr><tr><td>DD</td><td>01 02 ... 30 31</td></tr><tr><td><b>Day of Year</b></td><td></td></tr><tr><td>DDD</td><td>1 2 ... 364 365</td></tr><tr><td>DDDo</td><td>1st 2nd ... 364th 365th</td></tr><tr><td>DDDD</td><td>001 002 ... 364 365</td></tr><tr><td><b>Day of Week</b></td><td></td></tr><tr><td>d</td><td>0 1 ... 5 6</td></tr><tr><td>do</td><td>0th 1st ... 5th 6th</td></tr><tr><td>ddd</td><td>Sun Mon ... Fri Sat</td></tr><tr><td>dddd</td><td>Sunday Monday ... Friday Saturday</td></tr><tr><td><b>Week of Year</b></td><td></td></tr><tr><td>w</td><td>1 2 ... 52 53</td></tr><tr><td>wo</td><td>1st 2nd ... 52nd 53rd</td></tr><tr><td>ww</td><td>01 02 ... 52 53</td></tr><tr><td><b>Year</b></td><td></td></tr><tr><td>YY</td><td>70 71 ... 29 30</td></tr><tr><td>YYYY</td><td>1970 1971 ... 2029 2030</td></tr><tr><td><b>AM/PM</b></td><td></td></tr><tr><td>A</td><td>AM PM</td></tr><tr><td>a</td><td>am pm</td></tr><tr><td><b>Hour</b></td><td></td></tr><tr><td>H</td><td>0 1 ... 22 23</td></tr><tr><td>HH</td><td>00 01 ... 22 23</td></tr><tr><td>h</td><td>1 2 ... 11 12</td></tr><tr><td>hh</td><td>01 02 ... 11 12</td></tr><tr><td><b>Minute</b></td><td></td></tr><tr><td>m</td><td>0 1 ... 58 59</td></tr><tr><td>mm</td><td>00 01 ... 58 59</td></tr><tr><td><b>Second</b></td><td></td></tr><tr><td>s</td><td>0 1 ... 58 59</td></tr><tr><td>ss</td><td>00 01 ... 58 59</td></tr><tr><td><b>Timezone</b></td><td></td></tr><tr><td>z or zz (lowercase)</td><td>EST CST ... MST PST</td></tr><tr><td>Z</td><td>-07:00 -06:00 ... +06:00 +07:00</td></tr><tr><td>ZZ</td><td>-0700 -0600 ... +0600 +0700</td></tr><tr><td><b>Localized date format</b></td><td></td></tr><tr><td>LT</td><td>8:30 PM</td></tr><tr><td>L</td><td>07/10/1986</td></tr><tr><td>LL</td><td>July 10 1986</td></tr><tr><td>LLL</td><td>July 10 1986 8:30 PM</td></tr><tr><td>LLLL</td><td>Saturday, July 10 1986 8:30 PM</td></tr></tbody></table><p>To escape characters in format strings, you can use a backslash before any character. NOTE: if you are using a string literal, you will need to escape the backslash, hence the double backslash below.</p><pre>moment().format('\\L'); // outputs 'L'</pre><p>To escape multiple characters, you can wrap the characters in square brackets.</p><pre>moment().format('[today] DDDD'); // 'today Sunday'</pre><p>While these date formats are very similar to LDML date formats, there are a few minor differences regarding day of month, day of year, and day of week.</p><p>For a breakdown of a few different date formatting tokens, see <a href="https://docs.google.com/spreadsheet/ccc?key=0AtgZluze7WMJdDBOLUZfSFIzenIwOHNjaWZoeGFqbWc&amp;hl=en_US#gid=0">this chart of date formatting tokens.</a></p><p>To compare moment.js date formatting speeds against other libraries, check out <a href="http://jsperf.com/date-formatting">http://jsperf.com/date-formatting</a> .
 </p><p>Note: Baron Schwartz wrote a pretty cool date formatter that caches formatting functions to avoid expensive regex or string splitting. It's so much faster than any of the other libraries, that it's best to compare it on its own, rather than pollute the "best of the uncompiled" formatting libs.</p><p>Here's the <a href="http://jsperf.com/momentjs-vs-xaprb">moment.js vs xaprb</a> performance tests, and here is the
-<a href="http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/">article describing his methods.</a></p><a name="/display/from"></a><h3><span>Time from another moment</span></h3><p>Another common way of displaying time, sometimes called timeago, is handled by <code>moment.fn.from</code>.
+<a href="http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/">article describing his methods.</a></p><p>If you are more comfortable working with strftime instead of LDML-like parsing tokens, you can use Ben Oakes' plugin <code>moment-strftime</code> .
+</p><p>It is available on npm.</p><pre>npm install moment-strftime</pre><p>The repository is located at <a href="https://github.com/benjaminoakes/moment-strftime">benjaminoakes/moment-strftime</a></p><a name="/display/from"></a><h3><span>Time from another moment</span></h3><p>Another common way of displaying time, sometimes called timeago, is handled by <code>moment.fn.from</code>.
 </p><pre>var a = moment([2007, 0, 29]);
 var b = moment([2007, 0, 28]);
 a.from(b) // &quot;a day ago&quot;
@@ -108,8 +121,10 @@ a.diff(b, 'days') // 1
 var b = moment([2008, 5]);
 a.diff(b, 'years')       // 1
 a.diff(b, 'years', true) // 1.5
-</pre><a name="/display/native"></a><h3><span>Native Date</span></h3><p>To get the native Date object that Moment.js wraps, use <code>moment.fn.native</code>.
-</p><pre>moment([2007, 0, 29]).native(); // returns native Date object</pre><a name="/display/valueOf"></a><h3><span>Value</span></h3><p><code>moment.fn.valueOf</code>simply outputs the unix timestamp.
+</pre><a name="/display/toDate"></a><a name="/display/native"></a><h3><span>Native Javascript Date</span></h3><p>To get the native Date object that Moment.js wraps, use <code>moment.fn.toDate</code>.
+</p><pre>moment([2007, 0, 29]).toDate(); // returns native Date object</pre><p>Note: <code>moment.fn.native</code> has been replaced by 
+<code>moment.fn.toDate</code> and will be depreciated in the future.
+</p><a name="/display/valueOf"></a><h3><span>Value</span></h3><p><code>moment.fn.valueOf</code>simply outputs the unix timestamp.
 </p><pre>moment(1318874398806).valueOf(); // 1318874398806</pre><a name="/display/milliseconds"></a><h3><span>Milliseconds</span></h3><p>These are the getters mentioned in the <a href="#/manipulation/milliseconds">Manipulation</a>section above.
 </p><p>These map to the corresponding function on the native <code>Date</code>object.
 </p><pre>moment().milliseconds() === new Date().getMilliseconds();</pre><pre>moment().milliseconds(); // get the milliseconds (0 - 999)</pre><a name="/display/seconds"></a><h3><span>Seconds</span></h3><pre>moment().minutes(); // get the seconds (0 - 59)</pre><a name="/display/minutes"></a><h3><span>Minutes</span></h3><pre>moment().minutes(); // get the minutes (0 - 59)</pre><a name="/display/hours"></a><h3><span>Hours</span></h3><pre>moment().hours(); // get the hours (0 - 23)</pre><a name="/display/date"></a><h3><span>Date</span></h3><pre>moment().date(); // get the date of the month (1 - 31)</pre><a name="/display/day"></a><h3><span>Day</span></h3><pre>moment().day(); // get the day of the week (0 - 6)</pre><a name="/display/month"></a><h3><span>Month</span></h3><pre>moment().month(); // get the month (0 - 11)</pre><a name="/display/year"></a><h3><span>Year</span></h3><pre>moment().year(); // get the four digit year</pre><a name="/display/leapyear"></a><h3><span>Leap Year</span></h3><p><code>moment.fn.isLeapYear</code>returns true if that year is a leap year, and false if it is not.
@@ -250,7 +265,8 @@ moment(1316116057189).fromNow(); // il y a une heure
         (b === 2) ? 'nd' : 
         (b === 3) ? 'rd' : 'th';
 };
-</pre><p>For more information on ordinal numbers, see <a href="http://en.wikipedia.org/wiki/Ordinal_number_%28linguistics%29">wikipedia</a></p><div class="footer"></div></div></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="../js/docs.min.js?_=nocachebuster"></script><script>window._gaq = [['_setAccount','UA-10641787-5'],['_trackPageview'],['_trackPageLoadTime']];
+</pre><p>For more information on ordinal numbers, see <a href="http://en.wikipedia.org/wiki/Ordinal_number_%28linguistics%29">wikipedia</a></p><a name="/plugins"></a><h2><span>Plugins</span></h2><p>Some people have made plugins for moment.js that may be useful to you.</p><a name="/plugins/strftime"></a><h3><span>strftime</span></h3><p>If you are more comfortable working with strftime instead of LDML-like parsing tokens, you can use Ben Oakes' plugin <code>moment-strftime</code> .
+</p><p>It is available on npm.</p><pre>npm install moment-strftime</pre><p>The repository is located at <a href="https://github.com/benjaminoakes/moment-strftime">benjaminoakes/moment-strftime</a></p><div class="footer"></div></div></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="../js/docs.min.js?_=nocachebuster"></script><script>window._gaq = [['_setAccount','UA-10641787-5'],['_trackPageview'],['_trackPageLoadTime']];
 (function(d, c) {
   var ga = d.createElement(c); ga.async = true;
   ga.src = "http://www.google-analytics.com/ga.js";
index 9618a8b54ea11bc419f183aa7d12bf9493145c0f..0f5ec14abd0b09b4238f6e8e84e963025e8f7422 100644 (file)
                 month = this.month() - inputMoment.month(),
                 date = this.date() - inputMoment.date(),
                 output;
-
             if (val === 'months') {
                 output = year * 12 + month + date / 30;
             } else if (val === 'years') {