Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jul 29, 2015 @ 07:15
    Bo Damgaard Mortensen
    0

    Reuse Umbraco datetime picker in custom property editor

    Hi all,

    I'm creating a custom property editor which is using the built-in date (time) picker property editor.

    In my view, I'm using it like this:

    <umb-editor model="weekDay.open"></umb-editor>
    

    And in my controller:

    open: { 
        view: 'datepicker',
        config: { 
            pickDate: false,
            pickTime: true,
            pick12HourFormat: false,
            time24h: true,
            format: "HH:mm"
        }, 
        value: new Date()
    }
    

    While this works, it saves the entire datetime picker JSON when hitting save and publish, which is expected since the open property lives on model.value

    What I'd like is to save the selected time from the datetime picker, instead of saving the datetime picker JSON.

    Is this possible in some way? :-) I guess I'd have to make a change() method for when the datetime picker changes value and then update the model.value accordingly, but I'm not sure on how to make the change() method and how to make the datetime picker bind to an existing value when the view loads.

    Thanks in advance.

Please Sign in or register to post replies

Write your reply to:

Draft