Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
370
Default Hour and Minute in igx-time-picker dialog
posted

Please refer to above image. When opened in dialog mode the default hours and minutes are 12 and 00 respectively. I want to change this to 07:00. Is there any option available?

  • 700
    Offline posted

    Hello Shahab,

    Thank you for posting into our community!

    I have been looking into your question and what I could say is that by default, as mentioned in the IgxTimePicker’s specifications here, on dropdown/dialog opening the selected time will reflect the picker's value. However, in cases when the value is null, i.e., no value is selected, is outside the min/max range or does not match the items delta, the selected value in the dropdown/dialog will be the minimum possible value, i.e., 12:00 AM if the minValue is not provided, or the closest value that match items delta. This is the expected behavior and is not customizable.

    When opening the dropdown/dialog, the focused time portion could be:

    1. The default one, i.e., 12:00 AM, when no value is selected.
    2. The time portion of the selected value.
    3. The value of the minValue property when no value is selected.

    Having the abovementioned in mind, a possible approach I could suggest, in order to set the focused time portion to be as desired, is binding the IgxTimePicker’s value or ngModel to a Date object or time-only string value in ISO 8601 format. Then, when opening the dropdown/dialog, the currently focused time portion will be the custom one and not the default one. However, as I am not sure of the overall requirements, please note that this will set a default selected value if no value is selected by the user.

    More information that I believe you will find helpful could be found in our Binding section here.

    Additionally, another approach is setting the minValue property which will focus the desired time portion, however, it will not allow selecting a time before this value.

    Please let me know if you need any further assistance regarding this matter.

    Looking forward to your reply.

    Sincerely,
    Riva Ivanova
    Associate Software Developer