How to translate date in Angularjs datepicker?

I have a form and I am trying to pass a date using the http post directive and Angularjs datepicker. I am using the bootstrap user interface. When I pass the date to console.log I just see "" for the date. If you see anything that I am doing wrong or can be of any help, please let me know. I tried to use parent.dt too, but no luck. Thanks in advance.

App.js

var postData={
            firstName:$scope.newUser.name,
            email:$scope.newUser.email,
            date: $scope.parent.dt,
            termsPhone: $scope.newUser.termsPhone,
            termsEmail: $scope.newUser.termsEmail,           
            telephone: $scope.newUser.phoneNumber
    };
    //postData=JSON.stringify(postData);
    $http({method:'POST',
            url:'sendmail.php',
            data:postData,
            headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}})

        .success(function (data,status,headers,config) {

            console.log('Success: ' + data); 
            $scope.realDate = data;
            $scope.modalOpen = true;
            $scope.confirmation = true;
            $log.info($scope.newUser.dt);
            $log.info(postData);
        })
        .error(function (data, status,headers,config) {
            console.log('error' + status + data);
        });

      

Datepicker directive

<p class="input-group">
              <input type="text" class="form-control" datepicker-popup="" ng-model="$parent.dt" is-open="opened" min="minDate" max="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" date-type="string" />
              <span class="input-group-btn">
                <button class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
              </span>
            </p>

      

+3


source to share





All Articles