119
rated 0 times
[
126]
[
7]
/ answers: 1 / hits: 38795
/ 9 Years ago, tue, march 31, 2015, 12:00:00
Having a few issues with simply adding a day to a few dates in an Appcelerator project using moment.js
All I want to do, is grab today's date and then display it in the DD format (01) and then get the next 6 days as well.
Here is what I'm trying:
var todayDate = moment();
var day1 = todayDate.format(DD);
var day2 = todayDate.add(1, 'days').format(DD);
var day3 = todayDate.add(2, 'days').format(DD);
var day4 = todayDate.add(3, 'days').format(DD);
var day5 = todayDate.add(4, 'days').format(DD);
var day6 = todayDate.add(5, 'days').format(DD);
var day7 = todayDate.add(6, 'days').format(DD);
But, the output I get is the following:
[INFO] : 31
[INFO] : 01
[INFO] : 03
[INFO] : 06
[INFO] : 10
[INFO] : 15
[INFO] : 21
It should read:
[INFO] : 31
[INFO] : 01
[INFO] : 02
[INFO] : 03
[INFO] : 04
[INFO] : 05
[INFO] : 06
What am I doing wrong?
Simon
More From » date