Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18728] Android: Date picker Can't Select Date after year 2100AD

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-03-31T20:40:20.000+0000
Affected Version/sRelease 3.5.1
Fix Version/sRelease 4.1.0
ComponentsTiAPI
Labelsandroid, buddhist, datepicker
ReporterShuo Liang
AssigneeAshraf Abu
Created2015-03-23T01:14:07.000+0000
Updated2015-06-05T19:00:08.000+0000

Description

Android: Date picker Can't Select Date after year 2100AD

Steps to reproduce:

1.Run the following code in classic mobile project.
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(2200,4,1),
  value:new Date(2015,2,23),
  top:50,
  accessablityLabel: "data picker"
});

win.add(picker);
win.open();

picker.addEventListener('change',function(e){
  Ti.API.info("User selected date: " + e.value.toLocaleString());
});

Expect Result:

Date should be available to select until the max value

Actual Result:

Date only available to 2100AD, no matter what max value set.

Use case:

For Thailand Buddhist, the year is 543 behind Gregorian year. That is why we need select date after 2100AD.

N.B

Only happened in android device, iOS works well.

Comments

  1. Ashraf Abu 2015-03-30

    PR: https://github.com/appcelerator/titanium_mobile/pull/6753 Test steps.
       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(2200,4,1),
         value:new Date(2015,2,23),
         top:50,
         accessablityLabel: "data picker"
       });
       
       win.add(picker);
       win.open();
       
       picker.addEventListener('change',function(e){
         Ti.API.info("User selected date: " + e.value.toLocaleString());
       });
       
  2. Lokesh Choudhary 2015-06-05

    Verified the fix. We can now select date after 2100AD. Closing. Environment: Appc Studio : 4.0.1.201506021908 Ti SDK : 4.1.0.v20150604094312 CLI : 4.0.2-rc2 Alloy : 1.6.0 MAC Yosemite : 10.10.3 Appc npm : 4.0.0 Appc CLI : 4.0.1 Node: v0.10.37 Nexus 5 - Android 5.1.1

JSON Source