1

I need to to have only time picked in the form. I have a field

<field name="open">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">text</item>
            <item name="label" xsi:type="string" translate="true">Tuesday</item>
            <item name="formElement" xsi:type="string">date</item>
            <item name="source" xsi:type="string">somesource</item>
            <item name="dataScope" xsi:type="string">open</item>
            <item name="options" xsi:type="array">
                <item name="showsTime" xsi:type="boolean">true</item>
                <item name="timeOnly" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

hours and minuts scroll bars doesnt work properly for me. How to make the datepicked to show only time? Or how to make a field that saves time only

6
  • The default input (date) does not support this format, so you should create own input-element. Commented Sep 7, 2016 at 10:21
  • You need something similar to this ? Commented Sep 7, 2016 at 10:24
  • @SiarheyUchukhlebau do you know how to implement that one?
    – fmsthird
    Commented Apr 12, 2019 at 3:12
  • @magefms Sure, just use an inbound jQuery slider plugin. If you need an example - just send me a link to your question and I'll post an answer with my code. Commented Apr 12, 2019 at 6:30
  • here magento.stackexchange.com/questions/269454/…
    – fmsthird
    Commented Apr 12, 2019 at 6:30

1 Answer 1

4

Ciemin, try this code:

<field name="opening_time">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">string</item>
            <item name="label" xsi:type="string" translate="true">Opening time</item>
            <item name="formElement" xsi:type="string">date</item>
            <item name="source" xsi:type="string">page</item>
            <item name="sortOrder" xsi:type="number">70</item>
            <item name="dataScope" xsi:type="string">opening_time</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
            <item name="options" xsi:type="array">
                <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
                <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
                <item name="timeOnly" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

Result: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.