change months name(output) from datetime calender


I am creating a web app in which i am choosing a date from my Materialangular calender extender

<md-datepicker ng-model="mddate" ng-blur="dateformatechanged()" md-placeholder="Enter date"></md-datepicker>

and in my controler i am fetching the data like

   $scope.datemm = moment($scope.mddate).format('MM');
   $scope.dateyy = moment($scope.mddate).format('YYYY');

in my $scope.datemm the month will be 01,02,03,04 as per the month i select but i want to fetch data like (january,february,march,april)

what i need to do in my controller to change the month output

Show source
| javascript   | angularjs   | datetime   2017-01-03 06:01 1 Answers

Answers ( 1 )

  1. 2017-01-03 06:01

    Everything in your code is fine, but just change one line

    $scope.datemm = moment($scope.mddate).format('MM');


    $scope.datemm = moment($scope.mddate).format('MMM');

    if you want to print(jan)


    $scope.datemm = moment($scope.mddate).format('MMMM');

    if you want to print (january)

◀ Go back