Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18268] Titanium.UI.Picker - minDate / maxDate / value properties are not working

GitHub Issuen/a
TypeBug
PriorityNone
StatusResolved
ResolutionCannot Reproduce
Resolution Date2018-03-31T09:43:26.000+0000
Affected Version/sRelease 3.4.0, Release 3.4.1
Fix Version/sn/a
ComponentsMobileWeb
LabelsTCSupport, datepicker, mobileweb, picker
ReporterManojkumar Murugesan
AssigneeEric Merriman
Created2014-10-10T10:31:16.000+0000
Updated2018-03-31T09:43:26.000+0000

Description

Problem Description

Ti.UI.Picker min/max values are not working as expected (doesn't reflect in the running app).

Steps to reproduce

1. Create a new mobile project (Classic Titanium) 2. Replace the content of app.js with this code:
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
	
});
 
var picker = Ti.UI.createPicker({
	type : Ti.UI.PICKER_TYPE_DATE,
	minDate : new Date(1900, 0, 1),
        maxDate : new Date(),
        value : new Date(),
	top : 50
});
 
win.add(picker);
win.open();
 
picker.addEventListener('change', function(e) {
	Ti.API.info("User selected date: " + e.value.toLocaleString());
}); 
3. Run this into a browser.

Actual Results

1. setting value property has no effect 2. unwanted borders are added to the date picker.

Expected results

The setting value working as expected.

Comments

  1. Rodolfo Perottoni 2015-11-06

    Tried doing the same here. Setting it's minDate property still allows me to select dates previous to what is selected. iOS 9.1 Ti SDK 5.0.3.v20151002003129
  2. Manojkumar Murugesan 2015-11-07

    Are you sure, you complied and tested it on mobile web not as iOS app?
  3. Rodolfo Perottoni 2015-11-08

    Oh, sorry. I didn't see this ticket was for MobileWeb, although i'm having this same issue for iOS 9.1. No matter how i change the minDate/maxDate properties, my picker will still show all possible dates (even before/after what i have used as min/max) .
  4. Ghassan 2017-12-03

    This Bug still unsolved for after so many years.
  5. Hans Knöchel 2018-03-31

    This ticket is marked for MobileWeb. If it also happens on iOS, we could change it accordingly and fix it.
  6. Hans Knöchel 2018-03-31

    Tested on iOS and it works both on creation and after creation:
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow({
       	
       });
        
       var picker = Ti.UI.createPicker({
       	type : Ti.UI.PICKER_TYPE_DATE,
         value : new Date(),
       	top : 50
       });
       
       picker.minDate = new Date(2017, 0, 1);
       picker.maxDate = new Date();
        
       win.add(picker);
       win.open();
        
       picker.addEventListener('change', function(e) {
       	Ti.API.info("User selected date: " + e.value.toLocaleString());
       }); 
       
    For Android, TIMOB-25917 was created to be able to change it after creation as well (parity).

JSON Source