[AC-1714] moment().startOf('quarter') bugged
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2014-09-04T07:27:14.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | TCSupportTriage |
Reporter | Michael Stelly |
Assignee | Mauro Parra-Miranda |
Created | 2014-08-14T17:52:16.000+0000 |
Updated | 2016-03-08T07:38:12.000+0000 |
Description
Steps to Reproduce
Run this code in a test project. Notice that the values for today and quarterToDate are identical.
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));
Actual Result
[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'
Expected Result
quarterToDate - moment().startOf('quarter') = '2014-07-01T17:38:13.789Z'
Comments
JSON Source
Moment.js is not bugged. Alloy uses an outdated version of it. Executing ~~~ console.log("[alloy] - moment.version = " + JSON.stringify(moment.version)); ~~~ will return ~~~ [INFO] : [alloy] - moment.version = "2.1.0" ~~~
moment().startOf('quarter')
apparently wasn't implemented until 2.6. So, is it possible to convert this bug report to a feature request?If that's the case, then feel free to close. Thanks guys.
ALOY-1096