Copied to clipboard

Flag this post as spam?

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


  • Angelo 111 posts 260 karma points
    May 04, 2022 @ 19:22
    Angelo
    0

    Prevalue editor for dates

    Hello everyone

    anyone has a Prevalue editor for dates ?

    thank you

    AS

  • jenniecassin 2 posts 72 karma points
    May 11, 2022 @ 06:40
  • Angelo 111 posts 260 karma points
    May 11, 2022 @ 16:15
    Angelo
    0

    hello jenniecassin

    the problem is that i need to use datetimepicker inside my dataType parameters to choose a date but inside prevalueeditors there is none for dates or DateTImes ! :(

    thank you

  • jenniecassin 2 posts 72 karma points
    May 13, 2022 @ 02:21
    jenniecassin
    0

    my mistake. sorry for unrelated reply

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 13, 2022 @ 06:44
    Dave Woestenborghs
    0

    Hi Angelo,

    May ask what the use case is for having a date as prevalue ? There might be other ways around this.

    Dave

  • Angelo 111 posts 260 karma points
    May 13, 2022 @ 11:47
    Angelo
    0

    Hello Dave

    yes at the moment i have a free text input but its not the best solution :(

    i also had the picker form umbraco ...it works but im not able to configure it ...

    thank you

    AS

  • Angelo 111 posts 260 karma points
    May 21, 2022 @ 14:46
    Angelo
    101

    ok guys for any one wanting a prevalueeditor for dates here is the example for the same needs that i had

    View and controller:

    <div ng-controller="My.Date as vm">
        <umb-date-time-picker ng-model="vm.date" 
                              options="vm.config"
                              on-change="vm.datePickerChange(selectedDates, dateStr, instance)">
        </umb-date-time-picker>
    </div>
    
    
    
    (function () {
        "use strict";
    
        function datePicker($scope) {
    
            var vm = this;
            vm.date = $scope.model.value;
            var value;
    
            vm.config = {
                enableTime: false,
                dateFormat: "d-m-y",
                time_24hr: false
            };
    
            vm.datePickerChange = datePickerChange;
    
            function datePickerChange(selectedDates, dateStr, instance) {
                value = dateStr;
            }
    
            $scope.$on("formSubmitting", function () {
                $scope.model.value = value;
            });
        }
        angular.module("umbraco").controller("My.Date", datePicker);
    })();
    

    dont forget to put your js controller in the package.manifest file :) ...thats it

    thank you

    Angelo

Please Sign in or register to post replies

Write your reply to:

Draft