Utilizzando la data angolare $filter
in realtà posso ottenere l'attuale day, year and month
.Angularjs successivo e precedente giorno, anno, mese
Ma, come posso ottenere il successivo e precedente day, year, month
?
Questo è il codice che ho scritto, ma non so da dove cominciare con
$scope.month = $filter('date')(date, 'MMMM');//December-November like
$scope.day = $filter('date')(date, 'dd'); //01-31 like
$scope.year = $filter('date')(date,'yyyy');//2014 like
$scope.nextYear = Number($scope.year) + 1;
$scope.prevYear = Number($scope.year) - 1;
$scope.nextDay = ?
etc...
Avete qualche idea?
puoi usare 'http: // www.datejs.com /' plugin :) o 'http: // momentjs.com/docs /' :) –
+1 per usare moment.js, risparmierai il tuo tempo , semplifica il tuo codice e ai trucchi giustamente! – benek
@benek nah sto costruendo una direttiva e deve funzionare senza aiuti;) – sbaaaang