Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1714] moment().startOf('quarter') bugged

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2014-09-04T07:27:14.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsTCSupportTriage
ReporterMichael Stelly
AssigneeMauro Parra-Miranda
Created2014-08-14T17:52:16.000+0000
Updated2016-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

  1. Michael Stelly 2014-08-15

    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?
  2. Ed 2014-08-16

  3. Michael Stelly 2014-08-18

    If that's the case, then feel free to close. Thanks guys.
  4. Mauro Parra-Miranda 2014-09-04

    ALOY-1096

JSON Source