Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16173] Android: showDatePickerDialog and showTimePickerDialog ignore minDate and maxDate attributes

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-08-21T21:42:01.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sRelease 3.4.2, Release 3.5.0
ComponentsAndroid
Labelsandroid, module_picker, qe-manualtest, qe-testadded, showDatePickerDialog, showTimePickerDialog
ReporterJan Helleman
AssigneeSunila
Created2014-01-10T09:17:29.000+0000
Updated2014-11-21T18:49:36.000+0000

Description

The picker completely ignores the minDate and maxDate when shown as dialog. Code to reproduce:
    var pickerTime = Ti.UI.createPicker({
	    //value: now,
	    value: $.startDateTime.toDate(),
	    type: Titanium.UI.PICKER_TYPE_TIME,
    	maxDate: new Date(),
	    format24: true
	});
	
    pickerTime.showTimePickerDialog({format24: true});
var pickerDate = Ti.UI.createPicker({
    value: now,
    maxDate: new Date(),
    minDate: new Date(),
    type: Titanium.UI.PICKER_TYPE_DATE
});

    pickerDate.showDatePickerDialog();

Attachments

FileDateSize
app.js2014-10-06T21:52:54.000+0000724

Comments

  1. Ritu Agrawal 2014-01-12

    Moving this ticket to engineering as I was not able to make showDatePickerDialog and showTimePickerDialog work using the simple sample provided in the documentation. Note that adding a date or time picker to a window works fine so the issue is specific to showDatePickerDialog and showTimePickerDialog methods. http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Picker-method-showDatePickerDialog
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow({
         exitOnClose: true,
         layout: 'vertical'
       });
       
       var picker = Ti.UI.createPicker({
         type:Ti.UI.PICKER_TYPE_DATE,
         minDate:new Date(2009,0,1),
         maxDate:new Date(2014,11,31),
         value:new Date(2014,3,12)
       });
       
       win.open();
       
       picker.showDatePickerDialog({
         value: new Date(2010,8,1),
         callback: function(e) {
           if (e.cancel) {
             Ti.API.info('User canceled dialog');
           } else {
             Ti.API.info('User selected date: ' + e.value);
           }
         }
       });
       
  2. Viktor Korol 2014-06-26

    Bug still exist. Please fix.
  3. Ingo Muschenetz 2014-08-14

    3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.
  4. Sunila 2014-08-21

    https://github.com/appcelerator/titanium_mobile/pull/5977 Added support for minDate and maxDate in showDatePickerDialog. Code check the proxy if the minDate, maxDate values are not passed in.
  5. Ewan Harris 2014-10-06

    Verified fix on: Mac OSX 10.9.5 Appcelerator Studio, build: 3.4.0.201409261245 Titanium SDK build: 3.5.0.v20141003114918 Titanium CLI, build: 3.5.0-dev Alloy: 1.5.1 Android Emulator 4.4.2, Android Device S3 4.0.4 Using the attached app.js built to both device and emulator and the minDate and maxDate attributes are respected. Closing ticket.

JSON Source