Titanium JIRA Archive
Appcelerator Community (AC)

[AC-874] Time Picker value is always current date

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-09-04T07:38:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labelsapi, broken, proxy, time
ReporterLee Driscoll
AssigneeMauro Parra-Miranda
Created2014-03-06T20:36:04.000+0000
Updated2016-03-08T07:37:10.000+0000

Description

The getValue method always returns the current time. Assumedly, this has been mapped to the android method: TimePicker.getCurrentTime which only returns the current time.

Attachments

FileDateSize
time-picker-text.tar.gz2014-03-18T11:36:27.000+00005883521

Comments

  1. Ritu Agrawal 2014-03-10

    Please provide a simple and runnable test case to reproduce this issue.
  2. Ritu Agrawal 2014-03-17

    Resolving this ticket as the reporter has not provided requested information.
  3. Lee Driscoll 2014-03-17

    Here is the test case:
       <Alloy>
           <Picker type="Ti.UI.PICKER_TYPE_DATE" />
       </Alloy>
       
       <Alloy>
         <Window
               title="Form"
               exitOnClose="false"
               navBarHidden="true"
               layout="vertical"
               width="100%">
            <TextField
                   id="timeField"
                   hintText="DATE"
                   editable="false"
                   borderStyle="Ti.UI.INPUT_BORDERSTYLE_LINE"
                   top="10"
                   height="60"
                   width="100%"
                   onFocus="openTimePicker" />
         </Window>
       </Alloy>
       
       var timePickerController = Alloy.createController('fields/timePickerDialog', {
       	format24: true
       });
       function openTimePicker(e){
       	timePickerController.showForTextField(e.source);
       }
       
       function showForTextField(textField, opts){
       
       	opts = opts || {};
       
       	opts.callback = function(e) {
       		if(!e.cancel) {
       			var timeValue = e.value;
       			textField.value = timeValue.getHours() + ':' + timeValue.getMinutes();
       			textField.blur();
       		}
       	};
       
       	timePickerDialog.show(opts);
       }
       
  4. Ritu Agrawal 2014-03-17

    Thanks for providing the sample test case. I tried to run the code as it is but its throwing errors. Can you please confirm that you had included all the files? It would be helpful if you can zip up your test project and attach to this ticket.
  5. Lee Driscoll 2014-03-18

    I tried to attach a tar of my project but it's 40-something mb, so I 've just attached my app folder
  6. Lee Driscoll 2014-03-18

    Also, through putting together the sample project I found another bug. I really don't have time to do a full bug report at the moment but it's damn easy to explain: If a form field tries to acquire focus before it's containing window has been opened the app dies without an error. To test this, remove the focusable="false" flag from the TextField in index.xml (from the attached tar)
  7. Tim Poulsen 2014-03-24

    Until ALOY-263 is merged, you can't create date/time type pickers in XML. Edit: I guess my comment wasn't directly related to the problem you're facing. But I'll leave it here anyway to let you know that you'll be able to create these pickers in XML soon.
  8. Lee Driscoll 2014-03-24

    @Tim +1 for creating the pickers via XML, that'll be a great addition
  9. Ritu Agrawal 2014-03-25

    Lee - Can you please provide a test case that does not create date / time picker in XML so that we can troubleshoot your current issue?
  10. Lee Driscoll 2014-03-25

    Ritu - The attached project works for me.

JSON Source