Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

moment().startOf('quarter') bugged?

$
0
0

Searching the internet, I found no reference to this problem, but calling moment().startOf('quarter'); returns the same value as moment(). However, both month and year formats work fine.

Executing the following code:

var moment = require('alloy/moment');
 
var today = moment();
var monthToDate = moment().startOf('month');
var quarterToDate = moment().startOf('quarter');
var yearToDate = moment().startOf('year');
 
console.log(" today - moment() = " + JSON.stringify(today));
console.log("monthToDate - moment().startOf('month') = " + JSON.stringify(monthToDate));
console.log("quarterToDate - moment().startOf('quarter') = " + JSON.stringify(quarterToDate));
console.log("yearToDate - moment().startOf('year') = " + JSON.stringify(yearToDate));
will output:
[INFO] :   today - moment() = "2014-08-14T17:38:13.789Z"
[INFO] :   monthToDate - moment().startOf('month') = "2014-08-01T04:00:00.000Z"
[INFO] :   quarterToDate - moment().startOf('quarter') = "2014-08-14T17:38:13.789Z"
[INFO] :   yearToDate - moment().startOf('year') = "2014-01-01T05:00:00.000Z"
You'll notice that both today and quarterToDate return the same value. I'm posting a bug report on it. Just wanted to see if anyone else has encountered this problem.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>