Tuesday, October 22, 2013

Get tomorrow's date with moment.js and format it so that it will work in a date type HTML5 control.

function stringifyTomorrow() {
   var today = moment();
   var tomorrow = today.add('days', 1);
   return moment(tomorrow).format("YYYY-MM-DD");
}

 
 

Please also note:

  • there is also moment.utc()
  • there is also subtract
  • legit (dojo-flavored): if (moment() < moment(this.whatever.get("value"))) {

No comments:

Post a Comment