Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Trying to implement a DatePicker in a custom section in the Back Office.
keep getting moment.locale is not a function. in the browser console
Here's what I'm working with:
datepicker controller
angular.module("umbraco").controller("MyApp.DatepickerController", function ($scope, assetsService, angularHelper, $element) { //setup the default config var config = { language: 'en', pickDate: true, pickTime: false, useSeconds: true, format: "YYYY-MM-DD", icons: { time: "icon-time", date: "icon-calendar", up: "icon-chevron-up", down: "icon-chevron-down" } }; $scope.config = angular.extend(config, $scope.config); function applyDate(e) { angularHelper.safeApply($scope, function () { // when a date is changed, update the model if (e.date) { $scope.property.Value = e.date.format("YYYY-MM-DD"); } }); }; var filesToLoad = ["lib/datetimepicker/bootstrap-datetimepicker.js"]; assetsService.load(filesToLoad).then( function () { $element.find("div:first") .datetimepicker($scope.config) .on("dp.change", applyDate); }); });
view
<umb-control-group label="Arrival Date"> <div class="controls controls-row"> <div class="umb-editor umb-datepicker" ng-controller="MyApp.DatepickerController" id="from"> <div class="input-append date datepicker" style="position: relative;"> <input name="from" data-format="dd/MM/yyyy" type="text" ng-model="room.ArrivalDate" /> <span class="add-on"> <i data-date-icon="icon-calendar"></i> </span> </div> </div> </div> </umb-control-group>
package.manifest
{ javascript: [ '~/Umbraco/lib/moment/moment-with-locales.js', '~/App_Plugins/BookingsAdmin/datepicker.controller.js' ], css: [ '~/App_Plugins/BookingsAdmin/BookingsAdmin.style.css' ] }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
moment.locale making my life a living hell
Trying to implement a DatePicker in a custom section in the Back Office.
keep getting moment.locale is not a function. in the browser console
Here's what I'm working with:
datepicker controller
view
package.manifest
is working on a reply...