JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<body ng-app>
<div ng-controller="MainCtrl">
<input type="date"
ng-model="dateString"/>
<br/>{{ date }}
<br/>{{ date | date: 'yyyy-MM-dd' }}
</div>
</body>
JavaScript
function MainCtrl($scope, dateFilter) {
$scope.date = new Date();
$scope.$watch('date', function (date)
{
$scope.dateString = dateFilter(date, 'yyyy-MM-dd');
console.log('A', $scope.date, $scope.dateString);
});
$scope.$watch('dateString', function (dateString)
{
$scope.date = new Date(dateString);
console.log('B', $scope.date, $scope.dateString);
});
}