Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values with TimePicker #4

Open
engineering87 opened this issue Nov 14, 2023 · 0 comments
Open

Default values with TimePicker #4

engineering87 opened this issue Nov 14, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@engineering87
Copy link
Member

engineering87 commented Nov 14, 2023

Greetings,
when a default value is placed in the input, which must contain the value of the hour (in HH:mm format), the dropdown buttons which should contain the value of the hour and minutes are not valorised.
Furthermore, again if a default value is passed, the buttons with arrows next to the dropdowns, which are used to change the numerical value of the hour and minutes, do not update the global value reported in the initial input field.

Below is the applied workaround from which you can extract the fix to the problem:

$(function () {
    var $containers = $("input.sirio-timepicker").closest(".sirio-dropdown");
    $containers.each(function (index) {
        var $input = $(this).find(".sirio-timepicker");
        var value = $input.val();
        var pieces = value.split(':');
        var hour = "00";
        var minute = "00";
        if (pieces.length == 2) {
            hour = value.split(':')[0];
            minute = value.split(':')[1];
        }
        var $hourInput = $(this).find(".sirio-dropdown-timepicker-hour input");
        var $minuteInput = $(this).find(".sirio-dropdown-timepicker-min input");
        $hourInput.val(hour);
        $minuteInput.val(minute);
    });
})

Environment:

  • Version SIRIO: 7.0.0
@engineering87 engineering87 added the bug Something isn't working label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant