Wijmo 5 - Date and Time Input

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.input.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/interop/angular/wijmo.angular.min.js"></script>
<!-- mark this as an Angular application and give it a controller -->
<div ng-app="app" ng-controller="appCtrl" class="container">
    
<h1>Input date</h1>
    
    <p>always selects the first date of month</p>
    <wj-input-date 
        control="dateFirst"
        value="theFirstDate"
        selection-mode="Month"
        format="M/d/yyyy"
        value-changed="showFirst(dateFirst)">
    </wj-input-date>
    <p>always selects the last date of month</p>
    <wj-input-date 
        control="dateLast"
        value="theLastDate"
        selection-mode="Month"
        format="M/d/yyyy"
        value-changed="showLast(dateLast)">
    </wj-input-date>

    
</div>

CSS

.wj-calendar {
    max-width: 300px;
}

JavaScript

// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);

// controller
app.controller('appCtrl', function ($scope) {

    // the date/time being edited
    let today=new Date();
    $scope.theFirstDate = new Date(today.getFullYear(),today.getMonth(),1);
    $scope.theLastDate = new Date(today.getFullYear(),today.getMonth()+1,0);

		$scope.showFirst=(inputDate)=>{
    	let curDate=inputDate.value;
      let firstDate=new Date(curDate.getFullYear(), curDate.getMonth(), 1);
      if(curDate.getTime()!=firstDate.getTime()){
      	inputDate.value=firstDate;
      }
    }
    
    $scope.showLast=(inputDate)=>{
    	let curDate=inputDate.value;
      let lastDate=new Date(curDate.getFullYear(), curDate.getMonth()+1, 0);
      if(curDate.getTime()!=lastDate.getTime()){
      	inputDate.value=lastDate;
      }
    }
});