Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3232] Improve date picker to use Alloy.Globals reference

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-09-05T19:28:46.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsTCSupportTriage
ReporterMichael Stelly
AssigneeMauro Parra-Miranda
Created2014-08-15T13:39:35.000+0000
Updated2016-03-08T07:57:38.000+0000

Description

Steps to Reproduce

I have a global value for new Date() called Alloy.Globals.dates.today populated with the moment() method. At the moment, I cannot use the global reference in my date picker like this var datePicker = Ti.UI.createPicker({ maxDate : Alloy.Globals.dates.today }); I think this has more to do with moment.js than the Javascript Date object. Since moment.js is supported, I would expect to be able to use it as I see fit.

Actual Result

picker is disabled.

Expected Result

sets maxDate to today.

Comments

  1. Motiur Rahman 2014-08-19

    Hello, We have tested this issue. Its work as expected, we can use alloy global variable (which is populated with the moment() method) inside the date picker.

    Testing Environment:

    Titanium SDK: 3.3.0.GA, Titanium CLI: 3.3.0, Android SDK: 4.4.3, 4.2.2, Alloy:1.4.1, iOS SDK:7.1, OS X Version: 10.9.4, Appcelerator Studio: 3.3.0

    Steps to test the issue:

    1. Create a Alloy project. 2. Paste this code in alloy.js, index.js and index.xml file. 3. Run this code with the testing environment.

    Test Code

       var moment = require('alloy/moment');
       var today = moment().toDate();
       
       Ti.API.info(today);
       
       Alloy.Globals.todays = today;
       
       
       <Alloy>
       	<Window backgroundColor="blue" id='win'></Window>
       </Alloy>
       
       
       var picker = Ti.UI.createPicker({
       	type : Ti.UI.PICKER_TYPE_DATE,
       	minDate : new Date(2009, 0, 1),
       	maxDate : Alloy.Globals.todays,
       	value : new Date(2013, 4, 10)
       });
       
       $.win.add(picker);
       
       $.win.open();
       
       
    Thanks.
  2. Mauro Parra-Miranda 2014-09-05

    Please take a look into the testcase.
  3. Michael Stelly 2014-09-05

    Thanks, Mauro. I will.

JSON Source