I'm brand new to Angular and currently encountering some issues.
Here's what I'm trying to create:
- I need to display the current Date: yyyy-MM-ss (Functional)
- I want to show the current Calendar Week: yyyy-Www (Not Working)
- When a button is clicked, I want to add 10 days to today's date. (Only works for point 1)
CODE: JSFiddle
HTML
<div ng-controller="MyCtrl">
<div>
DateToday<br>
<input type="date" placeholder="yyyy-MM-dd" value="{{today | date :'yyyy-MM-dd'}}"><br><br>
CalendarWeek:<br>
<input type="week" placeholder="YYYY-W##" value="{{today | date :'yyyy-Www'}}"/><br><br>
<input ng-click="add10Days()" value="Add 10 Days" type="button"/>
</div>
</div>
JS/AngularJS:
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.today = new Date();
$scope.add10Days = function () {
var numberOfDaysToAdd = 10;
$scope.today.setDate($scope.today.getDate() + numberOfDaysToAdd);
};
});
I suspect it might be related to the week format yyyy-w## or possibly the browser (Chrome) I'm using. Any help would be greatly appreciated :)
Thank you