Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
ng-init for date.to and date.from
-
-
Hi @Phillip-Weeks ,
One can create a new usermodule component to handle like ng-init.
userModule.component('gettime', { bindings:{ timestampIn: '@?', tsFormat: '@?', newDateo: '=?', newDates: '=?' }, controller:['$scope', function($scope){ $scope.$watch('$ctrl.timestampIn', () => { let dateobject = moment(this.timestampIn); let datestring = moment(this.timestampIn).format(this.tsFormat); if (typeof this.timestampIn !== "undefined"){ this.newDateo = dateobject; this.newDates = datestring; //console.log(typeof(this.newDateo)); << returns dateobject //console.log(typeof(this.newDates)); << returns string } }, true); }] });new-dateo is date object which you should be able to use as your date.from / date.to variable.
new-dates is date string which is formatted like you want based on momentjs format function.Usage in dashboard:
<gettime timestamp-in="10/05/2019 22:10:10" ts-format="DD/MM/YYYY HH:mm:ss" new-dateo="js" new-dates="jss"></gettime> {{js}} <br> {{jss}}Result in dashboard:
Sat Oct 05 2019 22:10:10 GMT+0300 05/10/2019 22:10:10 -
<div ng-init="dateBar.from = ('2019-12-08T09:16:47.297' | maMoment:'toDate')"></div>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login