Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ras 66 posts 330 karma points
    Sep 06, 2022 @ 09:32
    Ras
    0

    Setting step value in a time picker

    I have a custom editor in Umbraco which is a Date Picker but instead of date it uses HH:mm format, so it's essentialy a Time Picker editor. Currently you pick through hours 1-24 and minutes 1-60 but what I want to do is make the step value on the minutes as 15 so that we instead pick between minutes 0-15-30-45, but I can't figure out a way to set this up. Any ideas how I can achieve this? I know it uses/supports the momentjs library but I can't find a way to make it work with anything I found in momentjs.

  • Bjarne Fyrstenborg 1286 posts 4060 karma points MVP 8x c-trib
    Sep 06, 2022 @ 10:13
    Bjarne Fyrstenborg
    0

    Hi Ras

    The date picker in Umbraco core is based on Flatpickr library, so it may be possible to configure this, but probably not from the current data type configuration.

    I am not sure if you can override the configuration directly, but alternatively you can add a custom property editor using the <umb-date-time-picker> component: https://github.com/umbraco/Umbraco-CMS/blob/v10/contrib/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.html

    It seems it is possible to use the minuteIncrement option where default value should be 5. https://stackoverflow.com/questions/61279712/flatpickr-is-it-possible-to-set-time-to-15-minute-intervals

    https://flatpickr.js.org/options/

  • Ras 66 posts 330 karma points
    Sep 07, 2022 @ 06:49
    Ras
    0

    Hi Bjarne, my mistake on this one. Apparently we only use the Umbraco date picker in the backoffice whereas in the actual view we are using a different date picker based on momentjs. (not using traditional forms, it's a custom made form)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies