Results 1 to 4 of 4

Thread: datepicker change time to 0 actomatically

  1. #1
    Sencha Premium User
    Join Date
    Dec 2016
    Posts
    10
    Answers
    1

    Question Answered: datepicker change time to 0 actomatically

    Ext6.2 modern toolkit.

    datepicker change time to 00:00:00 and cannot remain the original time of binding date object when choose a day from datepick.

    How could make it only change the day, month and year without changing hour, minute and second?

    For the problem, please check this fiddle:

    https://fiddle.sencha.com/#view/editor&fiddle/1mds

  2. I solved this by this code:

    Ext.define('Shipment.ux.field.DatePicker', {
    extend: 'Ext.field.DatePicker',
    xtype: 'ux-datepickerfield',


    updateValue: function(value, oldValue){
    if(oldValue){
    value.setHours(oldValue.getHours());
    value.setMinutes(oldValue.getMinutes());
    value.setSeconds(oldValue.getSeconds());
    }
    this.callParent([value, oldValue]);
    }
    });

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    The date picker only knows about the date (not time). I don't know of an override to make it ignore the time. There is a feature request for a time picker for the modern toolkit.
    https://www.sencha.com/forum/showthread.php?321955

  4. #3
    Sencha Premium User
    Join Date
    Dec 2016
    Posts
    10
    Answers
    1

    Default

    I solved this by this code:

    Ext.define('Shipment.ux.field.DatePicker', {
    extend: 'Ext.field.DatePicker',
    xtype: 'ux-datepickerfield',


    updateValue: function(value, oldValue){
    if(oldValue){
    value.setHours(oldValue.getHours());
    value.setMinutes(oldValue.getMinutes());
    value.setSeconds(oldValue.getSeconds());
    }
    this.callParent([value, oldValue]);
    }
    });

  5. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Glad to hear you found a solution and thanks for sharing it with the community.

Similar Threads

  1. Component xdatetime with one field datepicker and one listbox for time
    By marcelo.cavalini in forum Sencha Architect 3.x: Q&A
    Replies: 0
    Last Post: 3 Nov 2015, 2:38 AM
  2. Time picker change color on setValue or change
    By ExDev in forum Ext 5: Q&A
    Replies: 1
    Last Post: 15 Jul 2015, 6:23 AM
  3. How to change size of DatePicker
    By aloysius in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 17 Jan 2009, 6:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •