]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Adding day getter to docs
authorTim Wood <washwithcare@gmail.com>
Tue, 1 Nov 2011 22:00:54 +0000 (15:00 -0700)
committerTim Wood <washwithcare@gmail.com>
Tue, 1 Nov 2011 22:00:54 +0000 (15:00 -0700)
site/docs/index.html
sitesrc/docs.jade

index 40076a640112e33002aa1ff64461c560be02018d..57286dcbc0322ea61a96d80416ff675946347553 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"></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/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/month">Month</a></li><li><a href="#/manipulation/year">Year</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/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/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/month">Month</a></li><li><a href="#/display/year">Year</a></li><li><a href="#/display/leapyear">Leap Year</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>I18N</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/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/master/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.1.0</span><span class="filesize">2.5kb minified &amp; gzipped</span></a><a href="https://raw.github.com/timrwood/moment/master/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.1.0</span><span class="filesize">17.7kb 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"></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/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/month">Month</a></li><li><a href="#/manipulation/year">Year</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/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/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></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>I18N</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/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/master/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.1.0</span><span class="filesize">2.5kb minified &amp; gzipped</span></a><a href="https://raw.github.com/timrwood/moment/master/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.1.0</span><span class="filesize">17.7kb 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;
@@ -36,7 +36,7 @@ and calling with a parameter causes it to function as a setter.
 </p><p>These map to the corresponding function on the native <code>Date</code>object.
 </p><pre>moment().seconds(30) === new Date().setSeconds(30);
 moment().seconds() === new Date().getSeconds();
-</pre><a name="/manipulation/minutes"></a><h3><span>Minutes</span></h3><pre>moment().minutes(30); // set the minutes to 30</pre><a name="/manipulation/hours"></a><h3><span>Hours</span></h3><pre>moment().hours(12); // set the hours to 12</pre><a name="/manipulation/date"></a><h3><span>Day</span></h3><pre>moment().date(5); // set the date to 5</pre><a name="/manipulation/month"></a><h3><span>Month</span></h3><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="/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/minutes"></a><h3><span>Minutes</span></h3><pre>moment().minutes(30); // set the minutes to 30</pre><a name="/manipulation/hours"></a><h3><span>Hours</span></h3><pre>moment().hours(12); // set the hours to 12</pre><a name="/manipulation/date"></a><h3><span>Date</span></h3><pre>moment().date(5); // set the date to 5</pre><a name="/manipulation/month"></a><h3><span>Month</span></h3><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="/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;
@@ -84,7 +84,7 @@ a.diff(b, 'years', true) // 1.5
 </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.
 </p><pre>moment(1318874398806).valueOf(); // 1318874398806</pre><a name="/display/seconds"></a><h3><span>Seconds</span></h3><p>These are the getters mentioned in the <a href="#/manipulation/seconds">Manipulation</a>section above.
 </p><p>These map to the corresponding function on the native <code>Date</code>object.
-</p><pre>moment().seconds() === new Date().getSeconds();</pre><a name="/display/minutes"></a><h3><span>Minutes</span></h3><pre>moment().minutes(); // get the minutes</pre><a name="/display/hours"></a><h3><span>Hours</span></h3><pre>moment().hours(); // get the hours</pre><a name="/display/date"></a><h3><span>Date</span></h3><pre>moment().date(); // get the date </pre><a name="/display/month"></a><h3><span>Month</span></h3><pre>moment().month(); // get the month</pre><a name="/display/year"></a><h3><span>Year</span></h3><pre>moment().year(); // get the 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.
+</p><pre>moment().seconds() === new Date().getSeconds();</pre><a name="/display/minutes"></a><h3><span>Minutes</span></h3><pre>moment().minutes(); // get the minutes</pre><a name="/display/hours"></a><h3><span>Hours</span></h3><pre>moment().hours(); // get the hours</pre><a name="/display/date"></a><h3><span>Date</span></h3><pre>moment().date(); // get the date (0 - 31)</pre><a name="/display/day"></a><h3><span>Day</span></h3><pre>moment().day(); // get the day (0 - 6)</pre><a name="/display/month"></a><h3><span>Month</span></h3><pre>moment().month(); // get the month</pre><a name="/display/year"></a><h3><span>Year</span></h3><pre>moment().year(); // get the 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.
 </p><pre>moment([2000]).isLeapYear() // true
 moment([2001]).isLeapYear() // false
 
index 44c777cf64958291a3f4f91c16e0d75488284647..255c6fbac066fbcb596284bd10d1e03e41cb57b7 100644 (file)
@@ -86,6 +86,8 @@ block content
           a(href="#/display/hours") Hours
         li
           a(href="#/display/date") Date
+        li
+          a(href="#/display/day") Day
         li
           a(href="#/display/month") Month
         li
@@ -402,7 +404,7 @@ block content
 
       a(name="/manipulation/date")
       h3
-        span Day
+        span Date
       pre moment().date(5); // set the date to 5
 
 
@@ -764,7 +766,13 @@ block content
       a(name="/display/date")
       h3
         span Date
-      pre moment().date(); // get the date 
+      pre moment().date(); // get the date (0 - 31)
+
+
+      a(name="/display/day")
+      h3
+        span Day
+      pre moment().day(); // get the day (0 - 6)
 
 
       a(name="/display/month")