Permalink
Browse files

WIP 2.2.0 release

TODO:
* push moment develop, master, tags
* momentjs.com pull moment submodule
* verify all added stuff (links and documentation, tests)
* tweet, release on npm
  • Loading branch information...
1 parent 07c3e99 commit 588b8f308dead84baaa7dace0a8e25500a89cae4 @ichernev ichernev committed Sep 11, 2013
View
@@ -1,6 +1,6 @@
[submodule "libs/moment"]
path = libs/moment
- url = https://github.com/timrwood/moment.git
+ url = https://github.com/moment/moment.git
[submodule "libs/moment-timezone"]
path = libs/moment-timezone
url = https://github.com/moment/moment-timezone.git
@@ -0,0 +1,13 @@
+In addition to all shorthand methods for getting and setting the date you may specify the unit in a string:
+
+```javascript
+var m = moment();
+m.date() === m.get('date');
+m.clone().date(5) === m.clone().set('date', 5);
+```
+
+All supported units: year (years, y), month (months, M), date (dates, d), hour
+(hours, h), minute (minutes, m), second (seconds, s), millisecond
+(milliseconds, ms).
+
+*Note:* Units are case insensitive.
@@ -0,0 +1,29 @@
+You can create a moment object specifying only some of the units, and the rest
+will be defaulted to the current day, month or year, or 0 for hours, minutes,
+seconds and milliseconds.
+
+Defaulting to now, when nothing is passed:
+```javascript
+moment(); // current date and time
+```
+
+Defaulting to today, when only hours, minutes, seconds and milliseconds are passed:
+```javasript
+moment(5, "HH"); // today, 5:00:00.000
+moment({hour: 5}); // today, 5:00:00.000
+moment({hour: 5, minute: 10}); // today, 5:10.00.000
+moment({hour: 5, minute: 10, seconds: 20}); // today, 5:10.20.000
+moment({hour: 5, minute: 10, seconds: 20, milliseconds: 300}); // today, 5:10.20.300
+```
+
+Defaulting to this month and year, when only days and smaller units are passed:
+```javascript
+moment(5, "DD"); // this month, 5th day-of-month
+moment("4 05:06:07", "DD hh:mm:ss"); // this month, 4th day-of-month, 05:06:07.000
+```
+
+Defaulting to this year, if year is not specified:
+```javascript
+moment(3, "MM"); // this year, 3th month (April)
+moment("Apr 4 05:06:07", "MMM DD hh:mm:ss"); // this year, 5th April, 05:06:07.000
+```
@@ -32,7 +32,38 @@ It also works with a string that gets passed to `Date.parse()`
moment("not a date").isValid(); // false
```
-**Note:** The `moment#isValid` method will not work after manipulating the moment object with any of the manipulation methods.
+You may get the index of the invalid unit using `moment().invalidAt()`:
+
+```javascript
+var m = moment("2011-10-10T10:20:90");
+m.isValid(); // false
+m.invalidAt(); // 5 for seconds
+```
+
+The return value has the following meaning:
+
+<dl>
+ <dt>0</dt>
+ <dd>years</dd>
+ <dt>1</dt>
+ <dd>months</dd>
+ <dt>2</dt>
+ <dd>days</dd>
+ <dt>3</dt>
+ <dd>hours</dd>
+ <dt>4</dt>
+ <dd>minutes</dd>
+ <dt>5</dt>
+ <dd>seconds</dd>
+ <dt>6</dt>
+ <dd>milliseconds</dd>
+</dl>
+
+**Note:** In case of multiple wrong units the first one is returned (because
+days validity may depend on month, for example).
+
+**Note:** The `moment#isValid` method will not work after manipulating the
+moment object with any of the manipulation methods.
```javascript
moment("2011-10-10", "YYYY-MM-DD").isValid(); // true
@@ -0,0 +1,9 @@
+```javascript
+moment({hour: 15, minute: 10});
+moment({y: 2010, M: 3, d: 5, h: 15, m: 10, s: 3, ms: 123});
+moment({year: 2010, month: 3, day: 5, hour: 15, minute: 10, second: 3, millisecond: 123});
+moment({years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123});
+```
+
+You can create a moment object specifying some of the units in an object.
+Omitted units are defaulted to 0 or current date/month/year.
@@ -91,10 +91,15 @@ The parsing tokens are similar to the formatting tokens used in `moment#format`.
Unix timestamp
</td>
</tr>
+ <tr>
+ <td>LT, L, LL, LLL, LLLL</td>
+ <td>Locale dependent date and time representation</td>
+ </tr>
</tbody>
</table>
-`Z ZZ` were added in **1.2.0**. `S SS SSS` were added in **1.6.0**. `X` was added in `2.0.0`.
+`Z ZZ` were added in **1.2.0**. `S SS SSS` were added in **1.6.0**. `X` was
+added in `2.0.0`, `LT`, `L`, `LL`, `LLL`, `LLLL` was added in `2.2.0`.
Unless you specify a timezone offset, parsing a string will create a date in the current timezone.
@@ -0,0 +1,5 @@
+```
+bower install --save momentjs
+```
+
+Notable files are `moment.js`, `lang/*.js` and `min/moment+langs.js`.
View
@@ -9,20 +9,21 @@ module.exports = {
'da' : 'Danish',
'de' : 'German',
'el' : 'Greek',
- 'en' : 'English',
'en-ca' : 'English (Canada)',
+ 'en' : 'English',
'en-gb' : 'English (England)',
'eo' : 'Esperanto',
'es' : 'Spanish',
'et' : 'Estonian',
'eu' : 'Basque',
'fa' : 'Persian',
'fi' : 'Finnish',
- 'fr' : 'French',
'fr-ca' : 'French (Canada)',
+ 'fr' : 'French',
'gl' : 'Galician',
'he' : 'Hebrew',
'hi' : 'Hindi',
+ 'hr' : 'Croatian',
'hu' : 'Hungarian',
'id' : 'Bahasa Indonesia',
'is' : 'Icelandic',
@@ -31,18 +32,20 @@ module.exports = {
'ka' : 'Georgian',
'ko' : 'Korean',
'lv' : 'Latvian',
+ 'ml' : 'Malayalam',
+ 'mr' : 'Marathi',
'ms-my' : 'Bahasa Malaysian',
- 'ne' : 'Nepalese',
'nb' : 'Norwegian',
- 'nn' : 'Norwegian Nynorsk',
+ 'ne' : 'Nepalese',
'nl' : 'Dutch',
+ 'nn' : 'Norwegian Nynorsk',
'pl' : 'Polish',
- 'pt' : 'Portuguese',
'pt-br' : 'Portuguese (Brazil)',
+ 'pt' : 'Portuguese',
'ro' : 'Romanian',
'ru' : 'Russian',
- 'sl' : 'Slovenian',
'sk' : 'Slovak',
+ 'sl' : 'Slovenian',
'sq' : 'Albanian',
'sv' : 'Swedish',
'th' : 'Thai',
View
@@ -15,13 +15,17 @@ function toKb(input){
}
var core_src = fs.readFileSync(process.cwd() + '/libs/moment/moment.js', 'utf8');
+var bundle_src = fs.readFileSync(process.cwd() + '/libs/moment/min/moment+langs.js', 'utf8');
var core_min = fs.readFileSync(process.cwd() + '/libs/moment/min/moment.min.js', 'utf8');
+var bundle_min = fs.readFileSync(process.cwd() + '/libs/moment/min/moment+langs.min.js', 'utf8');
var timezone_src = fs.readFileSync(process.cwd() + '/libs/moment-timezone/moment-timezone.js', 'utf8');
var timezone_min = fs.readFileSync(process.cwd() + '/libs/moment-timezone/min/moment-timezone.min.js', 'utf8');
module.exports = {
core_size : toKb(core_src.length),
core_gzipped : null,
+ bundle_size : toKb(bundle_src.length),
+ bundle_gzipped : null,
core_version : moment.version,
timezone_size : toKb(timezone_src.length),
@@ -34,7 +38,12 @@ module.exports = {
zlib.gzip(timezone_min, function(err, gzip) {
module.exports.timezone_gzipped = toKb(gzip.length);
- cb();
+
+ zlib.gzip(bundle_min, function(err, gzip) {
+ module.exports.bundle_gzipped = toKb(gzip.length);
+
+ cb();
+ })
});
});
}
@@ -38,6 +38,14 @@
<strong>Full Source</strong>
<span class="filesize">{{ library.core_size }} </span>
</a>
+ <a class="button gzipped" href="https://rawgithub.com/timrwood/moment/{{ library.core_version }}/min/moment+langs.min.js">
+ <strong>Minified Source + Languages</strong>
+ <span class="filesize">{{ library.bundle_gzipped }}</span>
+ </a>
+ <a class="button source" href="https://rawgithub.com/timrwood/moment/{{ library.core_version }}/min/moment+langs.js">
+ <strong>Full Source + Languages</strong>
+ <span class="filesize">{{ library.bundle_size }} </span>
+ </a>
</div>
</aside>
{% endblock site_header %}
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 588b8f3

Please sign in to comment.