Copied to clipboard

Flag this post as spam?

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


  • Angelo 103 posts 226 karma points
    23 days ago
    Angelo
    0

    Prevalue editor for dates

    Hello everyone

    anyone has a Prevalue editor for dates ?

    thank you

    AS

  • jenniecassin 2 posts 72 karma points
    16 days ago
  • Angelo 103 posts 226 karma points
    16 days ago
    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
    15 days ago
    jenniecassin
    0

    my mistake. sorry for unrelated reply

  • Dave Woestenborghs 3413 posts 11575 karma points MVP 6x admin c-trib
    14 days ago
    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 103 posts 226 karma points
    14 days ago
    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 103 posts 226 karma points
    6 days ago
    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