Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15908] iOS:Picker: getValue method for picker returns incorrect time

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2013-12-06T18:32:22.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsiOS
Labelsqe-3.2.0
ReporterPriya Agarwal
AssigneeSabil Rahim
Created2013-12-06T06:10:17.000+0000
Updated2013-12-11T10:36:15.000+0000

Description

getValue method for picker returns incorrect time for both PICKER_TYPE_DATE and PICKER_TYPE_DATE_AND_TIME Picker. Works fine on Android. Not regression as issue occurs on 3.1.3.GA also.
var win = Ti.UI.createWindow();
 
var picker = Ti.UI.createPicker({
	    type : Ti.UI.PICKER_TYPE_DATE_AND_TIME,
	    selectionIndicator : true
	    
	});
	 
	var showDate = Ti.UI.createButton({
	    title : 'show date',
	    bottom : 20
	});
	showDate.addEventListener('click', function(e) {
	    alert(picker.getValue());
	});
	 
	var view = Ti.UI.createView({
	    width : Ti.UI.FILL,
	    height : Ti.UI.FILL
	});
	view.add(picker);
	view.add(showDate);
	 
	win.add(view);
 
win.open();
Steps to reproduce: 1)Copy paste the code and run the app. 2)Click on Show Date button. Actual Result: 2)Shows correct date and but incorrect time. Expected Result: 2)Should show correct date and time. Screen Shot shows the device correct time as 11:38am but the alert shows the incorrect time.

Attachments

FileDateSize
wrongtime.png2013-12-06T06:10:17.000+000066128

Comments

  1. Sabil Rahim 2013-12-06

    Invalid ticket. Picker time always returns value in GMT . The values should be converted to locale values. Updated test code
       var win = Ti.UI.createWindow({backgroundColor:'white'});
         
       var picker = Ti.UI.createPicker({
       	type : Ti.UI.PICKER_TYPE_DATE_AND_TIME,
       	selectionIndicator : true,
       });
       
       
       var showDate = Ti.UI.createButton({
       	title : 'show date',
       	bottom : 20
       });
       showDate.addEventListener('click', function(e) {
       	alert(picker.getValue().toLocaleString());
       });
         
       var view = Ti.UI.createView({
       	width : Ti.UI.FILL,
       	height : Ti.UI.FILL
       });
       view.add(picker);
       view.add(showDate);
         
       win.add(view);
         
       win.open();
       
    essentially do alert(picker.getValue().toLocaleString()); Marking ticket as invalid
  2. Priya Agarwal 2013-12-11

    Tested Environment: Appcelerator Studio: 3.2.0.201312101708 SDK:3.2.0.v20131210191510 alloy: 1.3.0-cr acs: 1.0.10 npm: 1.3.2 titanium: 3.2.0-cr titanium-code-processor: 1.1.0-cr Xcode:5.0.2 OS: Mac OSX 10.9 Device: iPhone Simulator(v7.0.3) Working fine. Used the above mentioned code to verify. Hence closing the issue

JSON Source