Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added more cli options

  • Loading branch information...
commit b104f2550b18ae7755997aa82e5c371ac2a0ed48 1 parent 2d2c8a2
@crcn authored
Showing with 7,416 additions and 3 deletions.
  1. +6 −0 README.md
  2. +46 −1 bin/gittyup
  3. +7 −1 lib/app.js
  4. +3 −0  node_modules/moment/.gitignore
  5. +124 −0 node_modules/moment/README.markdown
  6. +263 −0 node_modules/moment/build.js
  7. +1 −0  node_modules/moment/lang/all.min.js
  8. +41 −0 node_modules/moment/lang/es.js
  9. +1 −0  node_modules/moment/lang/es.min.js
  10. +41 −0 node_modules/moment/lang/fr.js
  11. +1 −0  node_modules/moment/lang/fr.min.js
  12. +42 −0 node_modules/moment/lang/it.js
  13. +1 −0  node_modules/moment/lang/it.min.js
  14. +41 −0 node_modules/moment/lang/nl.js
  15. +1 −0  node_modules/moment/lang/nl.min.js
  16. +41 −0 node_modules/moment/lang/pt.js
  17. +1 −0  node_modules/moment/lang/pt.min.js
  18. +157 −0 node_modules/moment/lang/test/en.js
  19. +157 −0 node_modules/moment/lang/test/es.js
  20. +149 −0 node_modules/moment/lang/test/fr.js
  21. +149 −0 node_modules/moment/lang/test/it.js
  22. +157 −0 node_modules/moment/lang/test/nl.js
  23. +149 −0 node_modules/moment/lang/test/pt.js
  24. +507 −0 node_modules/moment/moment.js
  25. +2 −0  node_modules/moment/moment.min.js
  26. +27 −0 node_modules/moment/package.json
  27. +1 −0  node_modules/moment/site/css/style.css
  28. +191 −0 node_modules/moment/site/docs/index.html
  29. BIN  node_modules/moment/site/favicon.ico
  30. BIN  node_modules/moment/site/img/clock-large.png
  31. BIN  node_modules/moment/site/img/clock.png
  32. BIN  node_modules/moment/site/img/gradient.gif
  33. +17 −0 node_modules/moment/site/index.html
  34. +1 −0  node_modules/moment/site/js/docs.min.js
  35. +1 −0  node_modules/moment/site/js/home.min.js
  36. +1 −0  node_modules/moment/site/js/lang-all.min.js
  37. +2 −0  node_modules/moment/site/js/moment.min.js
  38. +1 −0  node_modules/moment/site/js/test.min.js
  39. +8 −0 node_modules/moment/site/test/index.html
  40. +506 −0 node_modules/moment/sitesrc/css/style.css
  41. +1,010 −0 node_modules/moment/sitesrc/docs.jade
  42. +45 −0 node_modules/moment/sitesrc/home.jade
  43. +31 −0 node_modules/moment/sitesrc/html.jade
  44. +1 −0  node_modules/moment/sitesrc/js/docs.js
  45. +8 −0 node_modules/moment/sitesrc/js/home.js
  46. +919 −0 node_modules/moment/sitesrc/js/lang-tests.js
  47. +1,417 −0 node_modules/moment/sitesrc/js/qunit.js
  48. +814 −0 node_modules/moment/sitesrc/js/snippet.js
  49. +295 −0 node_modules/moment/sitesrc/js/unit-tests.js
  50. +17 −0 node_modules/moment/sitesrc/test.jade
  51. +13 −0 node_modules/moment/test.js
  52. +2 −1  package.json
View
6 README.md
@@ -15,6 +15,12 @@ Gittyup is a node.js deplyment library with some slick features:
## Command Line
gittyup checkout daisy --repo=https://github.com/crcn/daisy.git
+
+### Options
+ help
+ rollback :name Rollback a repositoriy
+ history :name Repo history
+ checkout :name :repo OR checkout :name checks out a repository
## Documentation
View
47 bin/gittyup
@@ -1,7 +1,8 @@
#!/usr/bin/env node
var celeri = require('celeri'),
gittyup = require('../')(),
-cfg = require('yaconfig').file('/etc/gittyup/apps.json');
+cfg = require('yaconfig').file('/etc/gittyup/apps.json'),
+moment = require('moment');
function gup(app) {
@@ -32,6 +33,50 @@ celeri.onCommand({ command: 'checkout :name :repo OR checkout :name', desc: 'che
em.on('error', function(){})
});
+celeri.onCommand({ command: 'history :name', desc: 'Repo history'}, function(request) {
+
+ var data = this.data,
+ name = data.name,
+ gap = gup(name);
+
+ gap.history(function(err, items) {
+
+ items.sort(function(a, b) {
+ return a.createdAt > b.createdAt ? 1 : -1;
+ });
+
+ celeri.table(items, {
+ columns: [{
+ name: function(item) {
+ return 'r'+item.release;
+ }
+ },
+ {
+ name: function(item) {
+ return moment(item.createdAt).fromNow()
+ }
+ }]
+ })
+ });
+});
+
+celeri.onCommand({ command: 'rollback :name', desc: 'Rollback a repositoriy'}, function(request) {
+
+ var data = this.data,
+ name = data.name,
+ gap = gup(name);
+
+ gap.rollback(function(err, items) {
+ gap.process(function(err, process) {
+ process.restart(function(err, result) {
+
+ });
+ });
+ });
+});
+
+
+
View
8 lib/app.js
@@ -325,7 +325,13 @@ var App = Structr({
{
if(err || !item) return callback(err, item);
- self.remove(item._id, callback);
+ self.remove(item._id, function()
+ {
+ self.current(function(err, item)
+ {
+ self.use(item._id, callback);
+ });
+ });
});
},
View
3  node_modules/moment/.gitignore
@@ -0,0 +1,3 @@
+underscore.date.iml
+.idea/*
+node_modules/
View
124 node_modules/moment/README.markdown
@@ -0,0 +1,124 @@
+Moment.js
+=========
+
+Moment.js is a javascript date library that helps create, manipulate, and format dates without extending the `Date` prototype.
+
+Author: Tim Wood
+
+Version: 1.0.1
+
+2.2 kb (min + gzip)
+
+Get it with npm
+===============
+
+ npm install moment
+
+Documentation
+=============
+
+Read the documentation at [momentjs.com/docs/](http://momentjs.com/docs/).
+
+Unit Tests
+==========
+
+Run the unit tests at [momentjs.com/test/](http://momentjs.com/test/).
+
+Thanks to...
+============
+
+The folks over at [date.js](http://code.google.com/p/datejs/).
+
+Everyone who helped with [php.js date](http://phpjs.org/functions/date:380).
+
+[Ryan McGeary](http://ryan.mcgeary.org/) for his work on the [jQuery timeago plugin](http://timeago.yarp.com/).
+
+License
+=======
+
+Moment.js is freely distributable under the terms of the MIT license.
+
+Changelog
+=========
+
+### 1.1.0
+
+Added `moment.fn.format` localized masks. 'L LL LLL LLLL' [issue 29](https://github.com/timrwood/moment/pull/29)
+
+Fixed [issue 31](https://github.com/timrwood/moment/pull/31).
+
+### 1.0.1
+
+Added `moment.version` to get the current version.
+
+Removed `window !== undefined` when checking if module exists to support browserify. [issue 25](https://github.com/timrwood/moment/pull/25)
+
+### 1.0.0
+
+Added convenience methods for getting and setting date parts.
+
+Added better support for `moment.add()`.
+
+Added better lang support in NodeJS.
+
+Renamed library from underscore.date to Moment.js
+
+### 0.6.1
+
+Added Portuguese, Italian, and French language support
+
+### 0.6.0
+
+Added _date.lang() support.
+Added support for passing multiple formats to try to parse a date. _date("07-10-1986", ["MM-DD-YYYY", "YYYY-MM-DD"]);
+Made parse from string and single format 25% faster.
+
+### 0.5.2
+
+Buxfix for [issue 8](https://github.com/timrwood/underscore.date/pull/8) and [issue 9](https://github.com/timrwood/underscore.date/pull/9).
+
+### 0.5.1
+
+Buxfix for [issue 5](https://github.com/timrwood/underscore.date/pull/5).
+
+### 0.5.0
+
+Dropped the redundant `_date.date()` in favor of `_date()`.
+Removed `_date.now()`, as it is a duplicate of `_date()` with no parameters.
+Removed `_date.isLeapYear(yearNuumber)`. Use `_date([yearNumber]).isLeapYear()` instead.
+Exposed customization options through the `_date.relativeTime`, `_date.weekdays`, `_date.weekdaysShort`, `_date.months`, `_date.monthsShort`, and `_date.ordinal` variables instead of the `_date.customize()` function.
+
+### 0.4.1
+
+Added date input formats for input strings.
+
+### 0.4.0
+
+Added underscore.date to npm. Removed dependancies on underscore.
+
+### 0.3.2
+
+Added `'z'` and `'zz'` to `_.date().format()`. Cleaned up some redundant code to trim off some bytes.
+
+### 0.3.1
+
+Cleaned up the namespace. Moved all date manipulation and display functions to the _.date() object.
+
+### 0.3.0
+
+Switched to the Underscore methodology of not mucking with the native objects' prototypes.
+Made chaining possible.
+
+### 0.2.1
+
+Changed date names to be a more pseudo standardized 'dddd, MMMM Do YYYY, h:mm:ss a'.
+Added `Date.prototype` functions `add`, `subtract`, `isdst`, and `isleapyear`.
+
+### 0.2.0
+
+Changed function names to be more concise.
+Changed date format from php date format to custom format.
+
+### 0.1.0
+
+Initial release
View
263 node_modules/moment/build.js
@@ -0,0 +1,263 @@
+var fs = require('fs'),
+ uglify = require('uglify-js'),
+ jshint = require('jshint'),
+ gzip = require('gzip'),
+ jade = require('jade'),
+ clean = require('clean-css');
+
+
+/*********************************************
+ Constants
+*********************************************/
+
+
+var JSHINT_CONFIG = {
+ "node" : true,
+ "es5" : true,
+ "browser" : true,
+ "boss" : false,
+ "curly": true,
+ "debug": false,
+ "devel": false,
+ "eqeqeq": true,
+ "eqnull": true,
+ "evil": false,
+ "forin": false,
+ "immed": false,
+ "laxbreak": false,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "onevar": true,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false,
+ "white": true
+};
+var LANG_MINIFY = "fr it pt es nl".split(" ");
+var LANG_TEST = "en fr it pt es nl".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.1';
+var MINIFY_COMMENT = '/* Moment.js | version : ' + VERSION + ' | author : Tim Wood | license : MIT */\n';
+var MINSIZE = 0;
+var SRCSIZE = 0;
+
+
+/*********************************************
+ Helpers
+*********************************************/
+
+/*
+ * function to minify a string and write to a file
+ *
+ * @param {String} source The source JS
+ * @param {String} dest The file destination
+ */
+function makeFile(filename, contents, callback) {
+ fs.writeFile(filename, contents, 'utf8', function(err) {
+ console.log('saved : ' + filename);
+ gzip(contents, function(err, data) {
+ console.log('size : ' + filename + ' ' + contents.length + ' b (' + data.length + ' b)');
+ });
+ if (callback) {
+ callback();
+ }
+ });
+}
+
+/*********************************************
+ Uglify
+*********************************************/
+
+/*
+ * function to minify a string and write to a file
+ *
+ * @param {String} source The source JS
+ * @param {String} dest The file destination
+ */
+function minifyToFile(source, dest, prefix, callback) {
+ var ast,
+ ugly;
+ ast = uglify.parser.parse(source);
+ ast = uglify.uglify.ast_mangle(ast);
+ ast = uglify.uglify.ast_squeeze(ast);
+ ugly = uglify.uglify.gen_code(ast);
+
+ makeFile('./' + dest + '.min.js', (prefix || '') + ugly);
+
+ if (callback) {
+ callback((prefix || '') + ugly);
+ }
+}
+
+
+/*********************************************
+ JSHint
+*********************************************/
+
+
+function logError(error) {
+ console.log('==== ' + error.id + ' ' + error.line + ':' + error.character);
+ console.log(' ' + error.reason);
+ console.log(' ' + error.evidence);
+}
+
+function hint(source, name) {
+ var passed = jshint.JSHINT(source, JSHINT_CONFIG);
+
+ if (passed) {
+ console.log('jshinted : ' + name);
+ return true;
+ } else {
+ console.log('============================================');
+ console.log(name + ' failed jshint ');
+ jshint.JSHINT.errors.forEach(logError);
+ console.log('============================================');
+ return false;
+ }
+}
+
+
+/*********************************************
+ Lang Minify
+*********************************************/
+
+
+(function(){
+ var allSource = '',
+ i,
+ failures = 0,
+ source;
+ for (i = 0; i < LANG_MINIFY.length; i++) {
+ source = fs.readFileSync('./lang/' + LANG_MINIFY[i] + '.js', 'utf8');
+ if (hint(source, 'lang/' + LANG_MINIFY[i])) {
+ minifyToFile(source, 'lang/' + LANG_MINIFY[i]);
+ allSource += source;
+ } else {
+ failures ++;
+ }
+ }
+ if (failures === 0) {
+ minifyToFile(allSource, 'lang/all');
+ minifyToFile(allSource, 'site/js/lang-all');
+ }
+})();
+
+
+/*********************************************
+ Lang Tests
+*********************************************/
+
+
+(function(){
+ var source = LANG_PREFIX;
+ for (i = 0; i < LANG_TEST.length; i++) {
+ source += fs.readFileSync('./lang/test/' + LANG_TEST[i] + '.js', 'utf8');
+ }
+ source += LANG_SUFFIX;
+ makeFile('./sitesrc/js/lang-tests.js', source, function(){
+ makeUnitTests();
+ });
+})();
+
+
+/*********************************************
+ Main
+*********************************************/
+
+
+(function(){
+ var source = fs.readFileSync('./moment.js', 'utf8');
+ if (hint(source, 'moment')) {
+ minifyToFile(source, 'moment', MINIFY_COMMENT, function(src){
+ gzip(src, function(err, data) {
+ MINSIZE = data.length;
+ makeDocs();
+ });
+ });
+ minifyToFile(source, 'site/js/moment', MINIFY_COMMENT);
+ }
+ gzip(source, function(err, data) {
+ SRCSIZE = source.length;
+ makeDocs();
+ console.log('size : ./moment.js ' + source.length + ' b (' + data.length + ' b)');
+ });
+})();
+
+
+/*********************************************
+ JS
+*********************************************/
+
+
+(function(){
+ var snippet = fs.readFileSync('./sitesrc/js/snippet.js', 'utf8');
+ var docs = fs.readFileSync('./sitesrc/js/docs.js', 'utf8');
+ minifyToFile(snippet + docs, 'site/js/docs');
+})();
+
+(function(){
+ var moment = fs.readFileSync('./moment.js', 'utf8');
+ var fr = fs.readFileSync('./lang/fr.js', 'utf8');
+ var snippet = fs.readFileSync('./sitesrc/js/snippet.js', 'utf8');
+ var home = fs.readFileSync('./sitesrc/js/home.js', 'utf8');
+ minifyToFile(moment + fr + snippet + home, 'site/js/home');
+})();
+
+function makeUnitTests(){
+ var q = fs.readFileSync('./sitesrc/js/qunit.js', 'utf8');
+ var u = fs.readFileSync('./sitesrc/js/unit-tests.js', 'utf8');
+ var l = fs.readFileSync('./sitesrc/js/lang-tests.js', 'utf8');
+ minifyToFile(q + u + l, 'site/js/test');
+}
+
+
+/*********************************************
+ Jade
+*********************************************/
+
+
+function toKb(input){
+ var num = Math.round(input / 100) / 10;
+ return num + 'kb';
+}
+
+function jadeToHtml(jadePath, htmlPath) {
+ var args = {
+ version : VERSION,
+ minsize : toKb(MINSIZE),
+ srcsize : toKb(SRCSIZE)
+ };
+ var snippet = fs.readFile(jadePath, 'utf8', function(err, data){
+ var compile = jade.compile(data, {
+ filename : 'sitesrc/html.jade'
+ });
+ makeFile(htmlPath, compile(args));
+ });
+}
+
+function makeDocs() {
+ if (SRCSIZE === 0 || MINSIZE === 0) {
+ return;
+ }
+ jadeToHtml('./sitesrc/home.jade', './site/index.html');
+ jadeToHtml('./sitesrc/docs.jade', './site/docs/index.html');
+ jadeToHtml('./sitesrc/test.jade', './site/test/index.html');
+}
+
+
+/*********************************************
+ CSS
+*********************************************/
+
+
+(function(){
+ fs.readFile('./sitesrc/css/style.css', 'utf8', function(err, data){
+ makeFile('./site/css/style.css', clean.process(data));
+ });
+})();
View
1  node_modules/moment/lang/all.min.js
@@ -0,0 +1 @@
+(function(){var a={months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"une année",yy:"%d années"},ordinal:function(a){return a===1?"er":"ème"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("fr",a)})(),function(){var a={months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settebre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_Lunedi_Martedi_Mercoledi_Giovedi_Venerdi_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"in %s",past:"%s fa",s:"secondi",m:"un minuto",mm:"%d minuti",h:"un ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("it",a)}(),function(){var a={months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Feb_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D \\de MMMM \\de YYYY",LLL:"D \\de MMMM \\de YYYY HH:mm",LLLL:"dddd, D \\de MMMM \\de YYYY HH:mm"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:function(a){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("pt",a)}(),function(){var a={months:"Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre".split("_"),monthsShort:"Ene._Feb._Mar._Abr._May._Jun._Jul._Ago._Sep._Oct._Nov._Dic.".split("_"),weekdays:"Domingo_Lunes_Martes_Miércoles_Jueves_Viernes_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mié._Jue._Vie._Sáb.".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(a){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("es",a)}(),function(){var a={months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._mei._jun._jul._aug._sep._okt._nov._dec.".split("_"),weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),longDateFormat:{L:"DD-MM-YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuutje",mm:"%d minuten",h:"één uur",hh:"%d uren",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaren"},ordinal:function(a){return a===1||a===8||a>=20?"ste":"de"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("nl",a)}()
View
41 node_modules/moment/lang/es.js
@@ -0,0 +1,41 @@
+(function () {
+ var lang = {
+ months : "Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre".split("_"),
+ monthsShort : "Ene._Feb._Mar._Abr._May._Jun._Jul._Ago._Sep._Oct._Nov._Dic.".split("_"),
+ weekdays : "Domingo_Lunes_Martes_Miércoles_Jueves_Viernes_Sábado".split("_"),
+ weekdaysShort : "Dom._Lun._Mar._Mié._Jue._Vie._Sáb.".split("_"),
+ longDateFormat : {
+ L : "DD/MM/YYYY",
+ LL : "D MMMM YYYY",
+ LLL : "D MMMM YYYY HH:mm",
+ LLLL : "dddd D MMMM YYYY HH:mm"
+ },
+ relativeTime : {
+ future : "en %s",
+ past : "hace %s",
+ s : "unos segundos",
+ m : "un minuto",
+ mm : "%d minutos",
+ h : "una hora",
+ hh : "%d horas",
+ d : "un día",
+ dd : "%d días",
+ M : "un mes",
+ MM : "%d meses",
+ y : "un año",
+ yy : "%d años"
+ },
+ ordinal : function (number) {
+ return 'º';
+ }
+ };
+
+ // Node
+ if (typeof module !== 'undefined') {
+ module.exports = lang;
+ }
+ // Browser
+ if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
+ this.moment.lang('es', lang);
+ }
+}());
View
1  node_modules/moment/lang/es.min.js
@@ -0,0 +1 @@
+(function(){var a={months:"Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre".split("_"),monthsShort:"Ene._Feb._Mar._Abr._May._Jun._Jul._Ago._Sep._Oct._Nov._Dic.".split("_"),weekdays:"Domingo_Lunes_Martes_Miércoles_Jueves_Viernes_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mié._Jue._Vie._Sáb.".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(a){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("es",a)})()
View
41 node_modules/moment/lang/fr.js
@@ -0,0 +1,41 @@
+(function () {
+ var lang = {
+ months : "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),
+ monthsShort : "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
+ weekdays : "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
+ weekdaysShort : "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
+ longDateFormat : {
+ L : "DD/MM/YYYY",
+ LL : "D MMMM YYYY",
+ LLL : "D MMMM YYYY HH:mm",
+ LLLL : "dddd D MMMM YYYY HH:mm"
+ },
+ relativeTime : {
+ future : "dans %s",
+ past : "il y a %s",
+ s : "quelques secondes",
+ m : "une minute",
+ mm : "%d minutes",
+ h : "une heure",
+ hh : "%d heures",
+ d : "un jour",
+ dd : "%d jours",
+ M : "un mois",
+ MM : "%d mois",
+ y : "une année",
+ yy : "%d années"
+ },
+ ordinal : function (number) {
+ return number === 1 ? 'er' : 'ème';
+ }
+ };
+
+ // Node
+ if (typeof module !== 'undefined') {
+ module.exports = lang;
+ }
+ // Browser
+ if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
+ this.moment.lang('fr', lang);
+ }
+}());
View
1  node_modules/moment/lang/fr.min.js
@@ -0,0 +1 @@
+(function(){var a={months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"une année",yy:"%d années"},ordinal:function(a){return a===1?"er":"ème"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("fr",a)})()
View
42 node_modules/moment/lang/it.js
@@ -0,0 +1,42 @@
+(function () {
+ var lang = {
+ months : "Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settebre_Ottobre_Novembre_Dicembre".split("_"),
+ monthsShort : "Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),
+ weekdays : "Domenica_Lunedi_Martedi_Mercoledi_Giovedi_Venerdi_Sabato".split("_"),
+ weekdaysShort : "Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),
+ // copied from french, needs revision from italian speakers
+ longDateFormat : {
+ L : "DD/MM/YYYY",
+ LL : "D MMMM YYYY",
+ LLL : "D MMMM YYYY HH:mm",
+ LLLL : "dddd, D MMMM YYYY HH:mm"
+ },
+ relativeTime : {
+ future : "in %s",
+ past : "%s fa",
+ s : "secondi",
+ m : "un minuto",
+ mm : "%d minuti",
+ h : "un ora",
+ hh : "%d ore",
+ d : "un giorno",
+ dd : "%d giorni",
+ M : "un mese",
+ MM : "%d mesi",
+ y : "un anno",
+ yy : "%d anni"
+ },
+ ordinal: function () {
+ return 'º';
+ }
+ };
+
+ // Node
+ if (typeof module !== 'undefined') {
+ module.exports = lang;
+ }
+ // Browser
+ if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
+ this.moment.lang('it', lang);
+ }
+}());
View
1  node_modules/moment/lang/it.min.js
@@ -0,0 +1 @@
+(function(){var a={months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settebre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_Lunedi_Martedi_Mercoledi_Giovedi_Venerdi_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"in %s",past:"%s fa",s:"secondi",m:"un minuto",mm:"%d minuti",h:"un ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("it",a)})()
View
41 node_modules/moment/lang/nl.js
@@ -0,0 +1,41 @@
+(function () {
+ var lang = {
+ months : "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),
+ monthsShort : "jan._feb._mar._apr._mei._jun._jul._aug._sep._okt._nov._dec.".split("_"),
+ weekdays : "zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),
+ weekdaysShort : "zo._ma._di._wo._do._vr._za.".split("_"),
+ longDateFormat : {
+ L : "DD-MM-YYYY",
+ LL : "MMMM D YYYY",
+ LLL : "MMMM D YYYY HH:mm",
+ LLLL : "dddd, D MMMM YYYY HH:mm"
+ },
+ relativeTime : {
+ future : "over %s",
+ past : "%s geleden",
+ s : "een paar seconden",
+ m : "één minuutje",
+ mm : "%d minuten",
+ h : "één uur",
+ hh : "%d uren",
+ d : "één dag",
+ dd : "%d dagen",
+ M : "één maand",
+ MM : "%d maanden",
+ y : "één jaar",
+ yy : "%d jaren"
+ },
+ ordinal : function (number) {
+ return (number === 1 || number === 8 || number >= 20) ? 'ste' : 'de';
+ }
+ };
+
+ // Node
+ if (typeof module !== 'undefined') {
+ module.exports = lang;
+ }
+ // Browser
+ if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
+ this.moment.lang('nl', lang);
+ }
+}());
View
1  node_modules/moment/lang/nl.min.js
@@ -0,0 +1 @@
+(function(){var a={months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._mei._jun._jul._aug._sep._okt._nov._dec.".split("_"),weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),longDateFormat:{L:"DD-MM-YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuutje",mm:"%d minuten",h:"één uur",hh:"%d uren",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaren"},ordinal:function(a){return a===1||a===8||a>=20?"ste":"de"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("nl",a)})()
View
41 node_modules/moment/lang/pt.js
@@ -0,0 +1,41 @@
+(function () {
+ var lang = {
+ months : "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),
+ monthsShort : "Jan_Feb_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),
+ weekdays : "Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),
+ weekdaysShort : "Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),
+ longDateFormat : {
+ L : "DD/MM/YYYY",
+ LL : "D \\de MMMM \\de YYYY",
+ LLL : "D \\de MMMM \\de YYYY HH:mm",
+ LLLL : "dddd, D \\de MMMM \\de YYYY HH:mm"
+ },
+ relativeTime : {
+ future : "em %s",
+ past : "%s atrás",
+ s : "segundos",
+ m : "um minuto",
+ mm : "%d minutos",
+ h : "uma hora",
+ hh : "%d horas",
+ d : "um dia",
+ dd : "%d dias",
+ M : "um mês",
+ MM : "%d meses",
+ y : "um ano",
+ yy : "%d anos"
+ },
+ ordinal : function (number) {
+ return 'º';
+ }
+ };
+
+ // Node
+ if (typeof module !== 'undefined') {
+ module.exports = lang;
+ }
+ // Browser
+ if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
+ this.moment.lang('pt', lang);
+ }
+}());
View
1  node_modules/moment/lang/pt.min.js
@@ -0,0 +1 @@
+(function(){var a={months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Feb_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),longDateFormat:{L:"DD/MM/YYYY",LL:"D \\de MMMM \\de YYYY",LLL:"D \\de MMMM \\de YYYY HH:mm",LLLL:"dddd, D \\de MMMM \\de YYYY HH:mm"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:function(a){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("pt",a)})()
View
157 node_modules/moment/lang/test/en.js
@@ -0,0 +1,157 @@
+
+/**************************************************
+ English
+ *************************************************/
+
+module("lang:en");
+
+test("format", 18, function() {
+ moment.lang('en');
+ var a = [
+ ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
+ ['ddd, hA', 'Sun, 3PM'],
+ ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'],
+ ['YYYY YY', '2010 10'],
+ ['D Do DD', '14 14th 14'],
+ ['d do dddd ddd', '0 0th Sunday Sun'],
+ ['DDD DDDo DDDD', '45 45th 045'],
+ ['w wo ww', '8 8th 08'],
+ ['h hh', '3 03'],
+ ['H HH', '15 15'],
+ ['m mm', '25 25'],
+ ['s ss', '50 50'],
+ ['a A', 'pm PM'],
+ ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45th day of the year'],
+ ['L', '02/14/2010'],
+ ['LL', 'February 14 2010'],
+ ['LLL', 'February 14 2010 3:25 PM'],
+ ['LLLL', 'Sunday, February 14 2010 3:25 PM']
+ ],
+ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
+ i;
+ for (i = 0; i < a.length; i++) {
+ equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
+ }
+});
+
+test("format YY", 1, function() {
+ var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
+ equal(b.format('YY'), '09', 'YY ---> 09');
+});
+
+test("format timezone", 2, function() {
+ var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
+ ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
+ ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
+});
+
+test("format ordinal", 31, function() {
+ moment.lang('en');
+ equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
+ equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
+ equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd');
+ equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th');
+ equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th');
+ equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th');
+ equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th');
+ equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th');
+ equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th');
+ equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th');
+
+ equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th');
+ equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th');
+ equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th');
+ equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th');
+ equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th');
+ equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th');
+ equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th');
+ equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th');
+ equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th');
+ equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th');
+
+ equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st');
+ equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd');
+ equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd');
+ equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th');
+ equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th');
+ equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th');
+ equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th');
+ equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th');
+ equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th');
+ equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th');
+
+ equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st');
+});
+
+test("format month", 12, function() {
+ moment.lang('en');
+ var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
+ }
+});
+
+test("format week", 7, function() {
+ moment.lang('en');
+ var expected = 'Sunday Sun_Monday Mon_Tuesday Tue_Wednesday Wed_Thursday Thu_Friday Fri_Saturday Sat'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
+ }
+});
+
+test("from", 30, function() {
+ moment.lang('en');
+ var start = moment([2007, 1, 28]);
+ equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "a few seconds", "44 seconds = a few seconds");
+ equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "a minute", "45 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "a minute", "89 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "an hour", "45 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "an hour", "89 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 hours", "90 minutes = 2 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 hours", "5 hours = 5 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 hours", "21 hours = 21 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "a day", "22 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "a day", "35 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 days", "36 hours = 2 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "a day", "1 day = a day");
+ equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 days", "5 days = 5 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 days", "25 days = 25 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "a month", "26 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "a month", "30 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "a month", "45 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 months", "46 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 months", "75 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 months", "76 days = 3 months");
+ equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "a month", "1 month = a month");
+ equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 months", "5 months = 5 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 months", "344 days = 11 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "a year", "345 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "a year", "547 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 years", "548 days = 2 years");
+ equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "a year", "1 year = a year");
+ equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 years", "5 years = 5 years");
+});
+
+test("suffix", 2, function() {
+ moment.lang('en');
+ equal(moment(30000).from(0), "in a few seconds", "prefix");
+ equal(moment(0).from(30000), "a few seconds ago", "suffix");
+});
+
+
+test("now from now", 1, function() {
+ moment.lang('en');
+ equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
+});
+
+
+test("fromNow", 2, function() {
+ moment.lang('en');
+ equal(moment().add({s:30}).fromNow(), "in a few seconds", "in a few seconds");
+ equal(moment().add({d:5}).fromNow(), "in 5 days", "in 5 days");
+});
+
View
157 node_modules/moment/lang/test/es.js
@@ -0,0 +1,157 @@
+
+/**************************************************
+ Spanish
+ *************************************************/
+
+module("lang:es");
+
+test("format", 18, function() {
+ moment.lang('es');
+ var a = [
+ ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Febrero 14º 2010, 3:25:50 pm'],
+ ['ddd, hA', 'Dom., 3PM'],
+ ['M Mo MM MMMM MMM', '2 2º 02 Febrero Feb.'],
+ ['YYYY YY', '2010 10'],
+ ['D Do DD', '14 14º 14'],
+ ['d do dddd ddd', '0 0º Domingo Dom.'],
+ ['DDD DDDo DDDD', '45 45º 045'],
+ ['w wo ww', '8 8º 08'],
+ ['h hh', '3 03'],
+ ['H HH', '15 15'],
+ ['m mm', '25 25'],
+ ['s ss', '50 50'],
+ ['a A', 'pm PM'],
+ ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45º day of the year'],
+ ['L', '14/02/2010'],
+ ['LL', '14 Febrero 2010'],
+ ['LLL', '14 Febrero 2010 15:25'],
+ ['LLLL', 'Domingo 14 Febrero 2010 15:25']
+ ],
+ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
+ i;
+ for (i = 0; i < a.length; i++) {
+ equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
+ }
+});
+
+test("format YY", 1, function() {
+ var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
+ equal(b.format('YY'), '09', 'YY ---> 09');
+});
+
+test("format timezone", 2, function() {
+ var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
+ ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
+ ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
+});
+
+test("format ordinal", 31, function() {
+ moment.lang('es');
+ equal(moment([2011, 0, 1]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 2]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 3]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 4]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 5]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 6]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 7]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 8]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 9]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
+
+ equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
+ equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
+ equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
+ equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º');
+ equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
+ equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
+ equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
+ equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
+ equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
+ equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
+
+ equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
+ equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
+ equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
+ equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º');
+ equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
+ equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
+ equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
+ equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
+ equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
+ equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
+
+ equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
+});
+
+test("format month", 12, function() {
+ moment.lang('es');
+ var expected = 'Enero Ene._Febrero Feb._Marzo Mar._Abril Abr._Mayo May._Junio Jun._Julio Jul._Agosto Ago._Septiembre Sep._Octubre Oct._Noviembre Nov._Diciembre Dic.'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
+ }
+});
+
+test("format week", 7, function() {
+ moment.lang('es');
+ var expected = 'Domingo Dom._Lunes Lun._Martes Mar._Miércoles Mié._Jueves Jue._Viernes Vie._Sábado Sáb.'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
+ }
+});
+
+test("from", 30, function() {
+ moment.lang('es');
+ var start = moment([2007, 1, 28]);
+ equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "unos segundos", "44 seconds = a few seconds");
+ equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minuto", "45 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minuto", "89 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutos", "90 seconds = 2 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutos", "44 minutes = 44 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "una hora", "45 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "una hora", "89 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 horas", "90 minutes = 2 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 horas", "5 hours = 5 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 horas", "21 hours = 21 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un día", "22 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un día", "35 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 días", "36 hours = 2 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un día", "1 day = a day");
+ equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 días", "5 days = 5 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 días", "25 days = 25 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mes", "26 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mes", "30 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mes", "45 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 meses", "46 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 meses", "75 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 meses", "76 days = 3 months");
+ equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mes", "1 month = a month");
+ equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 meses", "5 months = 5 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 meses", "344 days = 11 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un año", "345 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un año", "547 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 años", "548 days = 2 years");
+ equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un año", "1 year = a year");
+ equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 años", "5 years = 5 years");
+});
+
+test("suffix", 2, function() {
+ moment.lang('es');
+ equal(moment(30000).from(0), "en unos segundos", "prefix");
+ equal(moment(0).from(30000), "hace unos segundos", "suffix");
+});
+
+
+test("now from now", 1, function() {
+ moment.lang('es');
+ equal(moment().fromNow(), "hace unos segundos", "now from now should display as in the past");
+});
+
+
+test("fromNow", 2, function() {
+ moment.lang('es');
+ equal(moment().add({s:30}).fromNow(), "en unos segundos", "en unos segundos");
+ equal(moment().add({d:5}).fromNow(), "en 5 días", "en 5 días");
+});
+
View
149 node_modules/moment/lang/test/fr.js
@@ -0,0 +1,149 @@
+
+/**************************************************
+ French
+ *************************************************/
+
+module("lang:fr");
+
+test("format", 18, function() {
+ moment.lang('fr');
+ var a = [
+ ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14ème 2010, 3:25:50 pm'],
+ ['ddd, hA', 'dim., 3PM'],
+ ['M Mo MM MMMM MMM', '2 2ème 02 février févr.'],
+ ['YYYY YY', '2010 10'],
+ ['D Do DD', '14 14ème 14'],
+ ['d do dddd ddd', '0 0ème dimanche dim.'],
+ ['DDD DDDo DDDD', '45 45ème 045'],
+ ['w wo ww', '8 8ème 08'],
+ ['h hh', '3 03'],
+ ['H HH', '15 15'],
+ ['m mm', '25 25'],
+ ['s ss', '50 50'],
+ ['a A', 'pm PM'],
+ ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45ème day of the year'],
+ ['L', '14/02/2010'],
+ ['LL', '14 février 2010'],
+ ['LLL', '14 février 2010 15:25'],
+ ['LLLL', 'dimanche 14 février 2010 15:25']
+ ],
+ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
+ i;
+ for (i = 0; i < a.length; i++) {
+ equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
+ }
+});
+
+test("format YY", 1, function() {
+ var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
+ equal(b.format('YY'), '09', 'YY ---> 09');
+});
+
+test("format timezone", 2, function() {
+ var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
+ ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
+ ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
+});
+
+test("format ordinal", 31, function() {
+ moment.lang('fr');
+ equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er');
+ equal(moment([2011, 0, 2]).format('DDDo'), '2ème', '2ème');
+ equal(moment([2011, 0, 3]).format('DDDo'), '3ème', '3ème');
+ equal(moment([2011, 0, 4]).format('DDDo'), '4ème', '4ème');
+ equal(moment([2011, 0, 5]).format('DDDo'), '5ème', '5ème');
+ equal(moment([2011, 0, 6]).format('DDDo'), '6ème', '6ème');
+ equal(moment([2011, 0, 7]).format('DDDo'), '7ème', '7ème');
+ equal(moment([2011, 0, 8]).format('DDDo'), '8ème', '8ème');
+ equal(moment([2011, 0, 9]).format('DDDo'), '9ème', '9ème');
+ equal(moment([2011, 0, 10]).format('DDDo'), '10ème', '10ème');
+
+ equal(moment([2011, 0, 11]).format('DDDo'), '11ème', '11ème');
+ equal(moment([2011, 0, 12]).format('DDDo'), '12ème', '12ème');
+ equal(moment([2011, 0, 13]).format('DDDo'), '13ème', '13ème');
+ equal(moment([2011, 0, 14]).format('DDDo'), '14ème', '14ème');
+ equal(moment([2011, 0, 15]).format('DDDo'), '15ème', '15ème');
+ equal(moment([2011, 0, 16]).format('DDDo'), '16ème', '16ème');
+ equal(moment([2011, 0, 17]).format('DDDo'), '17ème', '17ème');
+ equal(moment([2011, 0, 18]).format('DDDo'), '18ème', '18ème');
+ equal(moment([2011, 0, 19]).format('DDDo'), '19ème', '19ème');
+ equal(moment([2011, 0, 20]).format('DDDo'), '20ème', '20ème');
+
+ equal(moment([2011, 0, 21]).format('DDDo'), '21ème', '21ème');
+ equal(moment([2011, 0, 22]).format('DDDo'), '22ème', '22ème');
+ equal(moment([2011, 0, 23]).format('DDDo'), '23ème', '23ème');
+ equal(moment([2011, 0, 24]).format('DDDo'), '24ème', '24ème');
+ equal(moment([2011, 0, 25]).format('DDDo'), '25ème', '25ème');
+ equal(moment([2011, 0, 26]).format('DDDo'), '26ème', '26ème');
+ equal(moment([2011, 0, 27]).format('DDDo'), '27ème', '27ème');
+ equal(moment([2011, 0, 28]).format('DDDo'), '28ème', '28ème');
+ equal(moment([2011, 0, 29]).format('DDDo'), '29ème', '29ème');
+ equal(moment([2011, 0, 30]).format('DDDo'), '30ème', '30ème');
+
+ equal(moment([2011, 0, 31]).format('DDDo'), '31ème', '31ème');
+});
+
+test("format month", 12, function() {
+ moment.lang('fr');
+ var expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
+ }
+});
+
+test("format week", 7, function() {
+ moment.lang('fr');
+ var expected = 'dimanche dim._lundi lun._mardi mar._mercredi mer._jeudi jeu._vendredi ven._samedi sam.'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
+ }
+});
+
+test("from", 30, function() {
+ moment.lang('fr');
+ var start = moment([2007, 1, 28]);
+ equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "quelques secondes", "44 seconds = a few seconds");
+ equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "une minute", "45 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "une minute", "89 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "une heure", "45 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "une heure", "89 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 heures", "90 minutes = 2 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 heures", "5 hours = 5 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 heures", "21 hours = 21 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un jour", "22 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un jour", "35 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 jours", "36 hours = 2 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un jour", "1 day = a day");
+ equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 jours", "5 days = 5 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 jours", "25 days = 25 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mois", "26 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mois", "30 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mois", "45 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mois", "46 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mois", "75 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mois", "76 days = 3 months");
+ equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mois", "1 month = a month");
+ equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mois", "5 months = 5 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mois", "344 days = 11 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "une année", "345 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "une année", "547 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 années", "548 days = 2 years");
+ equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "une année", "1 year = a year");
+ equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 années", "5 years = 5 years");
+});
+
+test("suffix", 2, function() {
+ moment.lang('fr');
+ equal(moment(30000).from(0), "dans quelques secondes", "prefix");
+ equal(moment(0).from(30000), "il y a quelques secondes", "suffix");
+});
+
+test("fromNow", 2, function() {
+ moment.lang('fr');
+ equal(moment().add({s:30}).fromNow(), "dans quelques secondes", "in a few seconds");
+ equal(moment().add({d:5}).fromNow(), "dans 5 jours", "in 5 days");
+});
View
149 node_modules/moment/lang/test/it.js
@@ -0,0 +1,149 @@
+
+/**************************************************
+ Italian
+ *************************************************/
+
+module("lang:it");
+
+test("format", 18, function() {
+ moment.lang('it');
+ var a = [
+ ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domenica, Febbraio 14º 2010, 3:25:50 pm'],
+ ['ddd, hA', 'Dom, 3PM'],
+ ['M Mo MM MMMM MMM', '2 2º 02 Febbraio Feb'],
+ ['YYYY YY', '2010 10'],
+ ['D Do DD', '14 14º 14'],
+ ['d do dddd ddd', '0 0º Domenica Dom'],
+ ['DDD DDDo DDDD', '45 45º 045'],
+ ['w wo ww', '8 8º 08'],
+ ['h hh', '3 03'],
+ ['H HH', '15 15'],
+ ['m mm', '25 25'],
+ ['s ss', '50 50'],
+ ['a A', 'pm PM'],
+ ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45º day of the year'],
+ ['L', '14/02/2010'],
+ ['LL', '14 Febbraio 2010'],
+ ['LLL', '14 Febbraio 2010 15:25'],
+ ['LLLL', 'Domenica, 14 Febbraio 2010 15:25']
+ ],
+ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
+ i;
+ for (i = 0; i < a.length; i++) {
+ equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
+ }
+});
+
+test("format YY", 1, function() {
+ var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
+ equal(b.format('YY'), '09', 'YY ---> 09');
+});
+
+test("format timezone", 2, function() {
+ var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
+ ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
+ ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
+});
+
+test("format ordinal", 31, function() {
+ moment.lang('it');
+ equal(moment([2011, 0, 1]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 2]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 3]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 4]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 5]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 6]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 7]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 8]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 9]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
+
+ equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
+ equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
+ equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
+ equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º');
+ equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
+ equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
+ equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
+ equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
+ equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
+ equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
+
+ equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
+ equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
+ equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
+ equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º');
+ equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
+ equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
+ equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
+ equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
+ equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
+ equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
+
+ equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
+});
+
+test("format month", 12, function() {
+ moment.lang('it');
+ var expected = 'Gennaio Gen_Febbraio Feb_Marzo Mar_Aprile Apr_Maggio Mag_Giugno Giu_Luglio Lug_Agosto Ago_Settebre Set_Ottobre Ott_Novembre Nov_Dicembre Dic'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
+ }
+});
+
+test("format week", 7, function() {
+ moment.lang('it');
+ var expected = 'Domenica Dom_Lunedi Lun_Martedi Mar_Mercoledi Mer_Giovedi Gio_Venerdi Ven_Sabato Sab'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
+ }
+});
+
+test("from", 30, function() {
+ moment.lang('it');
+ var start = moment([2007, 1, 28]);
+ equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "secondi", "44 seconds = seconds");
+ equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minuto", "45 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minuto", "89 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuti", "90 seconds = 2 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuti", "44 minutes = 44 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "un ora", "45 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "un ora", "89 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 ore", "90 minutes = 2 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 ore", "5 hours = 5 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 ore", "21 hours = 21 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un giorno", "22 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un giorno", "35 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 giorni", "36 hours = 2 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un giorno", "1 day = a day");
+ equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 giorni", "5 days = 5 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 giorni", "25 days = 25 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mese", "26 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mese", "30 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mese", "45 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mesi", "46 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mesi", "75 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mesi", "76 days = 3 months");
+ equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mese", "1 month = a month");
+ equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mesi", "5 months = 5 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mesi", "344 days = 11 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un anno", "345 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un anno", "547 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anni", "548 days = 2 years");
+ equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un anno", "1 year = a year");
+ equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anni", "5 years = 5 years");
+});
+
+test("suffix", 2, function() {
+ moment.lang('it');
+ equal(moment(30000).from(0), "in secondi", "prefix");
+ equal(moment(0).from(30000), "secondi fa", "suffix");
+});
+
+test("fromNow", 2, function() {
+ moment.lang('it');
+ equal(moment().add({s:30}).fromNow(), "in secondi", "in seconds");
+ equal(moment().add({d:5}).fromNow(), "in 5 giorni", "in 5 days");
+});
View
157 node_modules/moment/lang/test/nl.js
@@ -0,0 +1,157 @@
+
+/**************************************************
+ Dutch
+ *************************************************/
+
+module("lang:nl");
+
+test("format", 18, function() {
+ moment.lang('nl');
+ var a = [
+ ['dddd, MMMM Do YYYY, HH:mm:ss', 'zondag, februari 14de 2010, 15:25:50'],
+ ['ddd, HH', 'zo., 15'],
+ ['M Mo MM MMMM MMM', '2 2de 02 februari feb.'],
+ ['YYYY YY', '2010 10'],
+ ['D Do DD', '14 14de 14'],
+ ['d do dddd ddd', '0 0de zondag zo.'],
+ ['DDD DDDo DDDD', '45 45ste 045'],
+ ['w wo ww', '8 8ste 08'],
+ ['h hh', '3 03'],
+ ['H HH', '15 15'],
+ ['m mm', '25 25'],
+ ['s ss', '50 50'],
+ ['a A', 'pm PM'],
+ ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45ste day of the year'],
+ ['L', '14-02-2010'],
+ ['LL', 'februari 14 2010'],
+ ['LLL', 'februari 14 2010 15:25'],
+ ['LLLL', 'zondag, 14 februari 2010 15:25']
+ ],
+ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
+ i;
+ for (i = 0; i < a.length; i++) {
+ equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
+ }
+});
+
+test("format YY", 1, function() {
+ var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
+ equal(b.format('YY'), '09', 'YY ---> 09');
+});
+
+test("format timezone", 2, function() {
+ var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
+ ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
+ ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
+});
+
+test("format ordinal", 31, function() {
+ moment.lang('nl');
+ equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste');
+ equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de');
+ equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de');
+ equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de');
+ equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de');
+ equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de');
+ equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de');
+ equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste');
+ equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de');
+ equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de');
+
+ equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de');
+ equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de');
+ equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de');
+ equal(moment([2011, 0, 14]).format('DDDo'), '14de', '14de');
+ equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de');
+ equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de');
+ equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de');
+ equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de');
+ equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de');
+ equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste');
+
+ equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste');
+ equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste');
+ equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste');
+ equal(moment([2011, 0, 24]).format('DDDo'), '24ste', '24ste');
+ equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste');
+ equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste');
+ equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste');
+ equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste');
+ equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste');
+ equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste');
+
+ equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste');
+});
+
+test("format month", 12, function() {
+ moment.lang('nl');
+ var expected = 'januari jan._februari feb._maart mar._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
+ }
+});
+
+test("format week", 7, function() {
+ moment.lang('nl');
+ var expected = 'zondag zo._maandag ma._dinsdag di._woensdag wo._donderdag do._vrijdag vr._zaterdag za.'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
+ }
+});
+
+test("from", 30, function() {
+ moment.lang('nl');
+ var start = moment([2007, 1, 28]);
+ equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "een paar seconden", "44 seconds = a few seconds");
+ equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "één minuutje", "45 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "één minuutje", "89 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuten", "90 seconds = 2 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuten", "44 minutes = 44 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "één uur", "45 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "één uur", "89 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 uren", "90 minutes = 2 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 uren", "5 hours = 5 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 uren", "21 hours = 21 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "één dag", "22 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "één dag", "35 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dagen", "36 hours = 2 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "één dag", "1 day = a day");
+ equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dagen", "5 days = 5 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dagen", "25 days = 25 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "één maand", "26 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "één maand", "30 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "één maand", "45 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 maanden", "46 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 maanden", "75 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 maanden", "76 days = 3 months");
+ equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "één maand", "1 month = a month");
+ equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 maanden", "5 months = 5 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 maanden", "344 days = 11 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "één jaar", "345 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "één jaar", "547 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 jaren", "548 days = 2 years");
+ equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "één jaar", "1 year = a year");
+ equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 jaren", "5 years = 5 years");
+});
+
+test("suffix", 2, function() {
+ moment.lang('nl');
+ equal(moment(30000).from(0), "over een paar seconden", "prefix");
+ equal(moment(0).from(30000), "een paar seconden geleden", "suffix");
+});
+
+
+test("now from now", 1, function() {
+ moment.lang('nl');
+ equal(moment().fromNow(), "een paar seconden geleden", "now from now should display as in the past");
+});
+
+
+test("fromNow", 2, function() {
+ moment.lang('nl');
+ equal(moment().add({s:30}).fromNow(), "over een paar seconden", "in a few seconds");
+ equal(moment().add({d:5}).fromNow(), "over 5 dagen", "in 5 days");
+});
+
View
149 node_modules/moment/lang/test/pt.js
@@ -0,0 +1,149 @@
+
+/**************************************************
+ Portuguese
+ *************************************************/
+
+module("lang:pt");
+
+test("format", 18, function() {
+ moment.lang('pt');
+ var a = [
+ ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'],
+ ['ddd, hA', 'Dom, 3PM'],
+ ['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Feb'],
+ ['YYYY YY', '2010 10'],
+ ['D Do DD', '14 14º 14'],
+ ['d do dddd ddd', '0 0º Domingo Dom'],
+ ['DDD DDDo DDDD', '45 45º 045'],
+ ['w wo ww', '8 8º 08'],
+ ['h hh', '3 03'],
+ ['H HH', '15 15'],
+ ['m mm', '25 25'],
+ ['s ss', '50 50'],
+ ['a A', 'pm PM'],
+ ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45º day of the year'],
+ ['L', '14/02/2010'],
+ ['LL', '14 de Fevereiro de 2010'],
+ ['LLL', '14 de Fevereiro de 2010 15:25'],
+ ['LLLL', 'Domingo, 14 de Fevereiro de 2010 15:25']
+ ],
+ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
+ i;
+ for (i = 0; i < a.length; i++) {
+ equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
+ }
+});
+
+test("format YY", 1, function() {
+ var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
+ equal(b.format('YY'), '09', 'YY ---> 09');
+});
+
+test("format timezone", 2, function() {
+ var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
+ ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
+ ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
+});
+
+test("format ordinal", 31, function() {
+ moment.lang('pt');
+ equal(moment([2011, 0, 1]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 2]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 3]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 4]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 5]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 6]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 7]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 8]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 9]).format('DDDo'), '', '');
+ equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
+
+ equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
+ equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
+ equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
+ equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º');
+ equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
+ equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
+ equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
+ equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
+ equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
+ equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
+
+ equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
+ equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
+ equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
+ equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º');
+ equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
+ equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
+ equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
+ equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
+ equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
+ equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
+
+ equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
+});
+
+test("format month", 12, function() {
+ moment.lang('pt');
+ var expected = 'Janeiro Jan_Fevereiro Feb_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
+ }
+});
+
+test("format week", 7, function() {
+ moment.lang('pt');
+ var expected = 'Domingo Dom_Segunda-feira Seg_Terça-feira Ter_Quarta-feira Qua_Quinta-feira Qui_Sexta-feira Sex_Sábado Sáb'.split("_");
+ var i;
+ for (i = 0; i < expected.length; i++) {
+ equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
+ }
+});
+
+test("from", 30, function() {
+ moment.lang('pt');
+ var start = moment([2007, 1, 28]);
+ equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "segundos", "44 seconds = seconds");
+ equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "um minuto", "45 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "um minuto", "89 seconds = a minute");
+ equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutos", "90 seconds = 2 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutos", "44 minutes = 44 minutes");
+ equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "uma hora", "45 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "uma hora", "89 minutes = an hour");
+ equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 horas", "90 minutes = 2 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 horas", "5 hours = 5 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 horas", "21 hours = 21 hours");
+ equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "um dia", "22 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "um dia", "35 hours = a day");
+ equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dias", "36 hours = 2 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "um dia", "1 day = a day");
+ equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dias", "5 days = 5 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dias", "25 days = 25 days");
+ equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "um mês", "26 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "um mês", "30 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "um mês", "45 days = a month");
+ equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 meses", "46 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 meses", "75 days = 2 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 meses", "76 days = 3 months");
+ equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "um mês", "1 month = a month");
+ equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 meses", "5 months = 5 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 meses", "344 days = 11 months");
+ equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "um ano", "345 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "um ano", "547 days = a year");
+ equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anos", "548 days = 2 years");
+ equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "um ano", "1 year = a year");
+ equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anos", "5 years = 5 years");
+});
+
+test("suffix", 2, function() {
+ moment.lang('pt');
+ equal(moment(30000).from(0), "em segundos", "prefix");
+ equal(moment(0).from(30000), "segundos atrás", "suffix");
+});
+
+test("fromNow", 2, function() {
+ moment.lang('pt');
+ equal(moment().add({s:30}).fromNow(), "em segundos", "in seconds");
+ equal(moment().add({d:5}).fromNow(), "em 5 dias", "in 5 days");
+});
View
507 node_modules/moment/moment.js
@@ -0,0 +1,507 @@
+// Moment.js
+//
+// (c) 2011 Tim Wood
+// Moment.js is freely distributable under the terms of the MIT license.
+//
+// Version 1.1.1
+
+(function (Date, undefined) {
+
+ var moment,
+ round = Math.round,
+ languages = {},
+ hasModule = (typeof module !== 'undefined'),
+ paramsToParse = 'months|monthsShort|weekdays|weekdaysShort|longDateFormat|relativeTime|ordinal'.split('|'),
+ i,
+ VERSION = "1.1.1",
+ shortcuts = 'Month|Date|Hours|Minutes|Seconds'.split('|');
+
+ // left zero fill a number
+ // see http://jsperf.com/left-zero-filling for performance comparison
+ function leftZeroFill(number, targetLength) {
+ var output = number + '';
+ while (output.length < targetLength) {
+ output = '0' + output;
+ }
+ return output;
+ }
+
+ // helper function for _.addTime and _.subtractTime
+ function dateAddRemove(date, _input, adding, val) {
+ var isString = (typeof _input === 'string'),
+ input = isString ? {} : _input,
+ ms, M, currentDate;
+ if (isString && val) {
+ input[_input] = val;
+ }
+ ms = (input.ms || input.milliseconds || 0) +
+ (input.s || input.seconds || 0) * 1e3 + // 1000
+ (input.m || input.minutes || 0) * 6e4 + // 1000 * 60
+ (input.h || input.hours || 0) * 36e5 + // 1000 * 60 * 60
+ (input.d || input.days || 0) * 864e5 + // 1000 * 60 * 60 * 24
+ (input.w || input.weeks || 0) * 6048e5; // 1000 * 60 * 60 * 24 * 7
+ M = (input.M || input.months || 0) +
+ (input.y || input.years || 0) * 12;
+ if (ms) {
+ date.setTime(+date + ms * adding);
+ }
+ if (M) {
+ currentDate = date.getDate();
+ date.setDate(1);
+ date.setMonth(date.getMonth() + M * adding);
+ date.setDate(Math.min(new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(), currentDate));
+ }
+ return date;
+ }
+
+ // check if is an array
+ function isArray(input) {
+ return Object.prototype.toString.call(input) === '[object Array]';
+ }
+
+ // convert an array to a date.
+ // the array should mirror the parameters below
+ // note: all values past the year are optional and will default to the lowest possible value.
+ // [year, month, day , hour, minute, second, millisecond]
+ function dateFromArray(input) {
+ return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);
+ }
+
+ // format date using native date object
+ function formatDate(date, inputString) {
+ var currentMonth = date.getMonth(),
+ currentDate = date.getDate(),
+ currentYear = date.getFullYear(),
+ currentDay = date.getDay(),
+ currentHours = date.getHours(),
+ currentMinutes = date.getMinutes(),
+ currentSeconds = date.getSeconds(),
+ charactersToReplace = /(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|LL?L?L?)/g,
+ nonuppercaseLetters = /[^A-Z]/g,
+ timezoneRegex = /\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,
+ ordinal = moment.ordinal;
+ // check if the character is a format
+ // return formatted string or non string.
+ //
+ // uses switch/case instead of an object of named functions (like http://phpjs.org/functions/date:380)
+ // for minification and performance
+ // see http://jsperf.com/object-of-functions-vs-switch for performance comparison
+ function replaceFunction(input) {
+ // create a couple variables to be used later inside one of the cases.
+ var a, b;
+ switch (input) {
+ // MONTH
+ case 'M' :
+ return currentMonth + 1;
+ case 'Mo' :
+ return (currentMonth + 1) + ordinal(currentMonth + 1);
+ case 'MM' :
+ return leftZeroFill(currentMonth + 1, 2);
+ case 'MMM' :
+ return moment.monthsShort[currentMonth];
+ case 'MMMM' :
+ return moment.months[currentMonth];
+ // DAY OF MONTH
+ case 'D' :
+ return currentDate;
+ case 'Do' :
+ return currentDate + ordinal(currentDate);
+ case 'DD' :
+ return leftZeroFill(currentDate, 2);
+ // DAY OF YEAR
+ case 'DDD' :
+ a = new Date(currentYear, currentMonth, currentDate);
+ b = new Date(currentYear, 0, 1);
+ return ~~ (((a - b) / 864e5) + 1.5);
+ case 'DDDo' :
+ a = replaceFunction('DDD');
+ return a + ordinal(a);
+ case 'DDDD' :
+ return leftZeroFill(replaceFunction('DDD'), 3);
+ // WEEKDAY
+ case 'd' :
+ return currentDay;
+ case 'do' :
+ return currentDay + ordinal(currentDay);
+ case 'ddd' :
+ return moment.weekdaysShort[currentDay];
+ case 'dddd' :
+ return moment.weekdays[currentDay];