Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10949] iOS: Picker: getValue method for date picker, created without value property, return null till change event occurs

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-06-20T20:58:17.000+0000
Affected Version/sRelease 2.1.3, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, parity, qe-ios090112
ReporterSatyam Sekhri
AssigneeEric Merriman
Created2012-09-18T01:44:07.000+0000
Updated2017-06-20T20:58:17.000+0000

Description

The date picker created without a value property returns null for getValue method till date is changed in the picker. This works fine in Android. This is not a regression. The issue occurs atleast as far as 2.0.1 Steps to Reproduce: 1. Create a test application with code below 2. Launch the application and click on the Get Value button and check console 3. Change the date 4. Again click on the Get Value button and check console Actual Result: After step 2: The getValue returns null After step 4: The getValue returns the selected value in the picker Expected Result: After step 2: The getValue should return the selected value (as the current date is shown selected in the picker by default)
var win = Ti.UI.createWindow({
    backgroundColor: '#000',
    layout: 'vertical',
    navBarHidden: true
});
  
var datePicker = Ti.UI.createPicker({
    type: Ti.UI.PICKER_TYPE_DATE,
    useSpinner: false
});
  
datePicker.addEventListener('change', function(e) {
  Ti.API.info('change event: value = ' + e.value);
});
  
var button = Ti.UI.createButton({
    title: 'Get value'
});
  
button.addEventListener('click', function(){
    Ti.API.info(datePicker.value);
    Ti.API.info(datePicker.getValue());
});
   
win.add(datePicker);
win.add(button);
  
win.open();

Comments

  1. jithinpv 2013-03-22

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) iOS iPhone Simulator: iOS SDK version: 6.0 jithinpv
  2. Lee Morris 2017-06-20

    I am unable to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170620103414 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source