Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Using with MongoDB #157

Closed
anonrig opened this issue Feb 29, 2016 · 3 comments
Closed

Using with MongoDB #157

anonrig opened this issue Feb 29, 2016 · 3 comments

Comments

@anonrig
Copy link

anonrig commented Feb 29, 2016

Hello,

I am using ui-date with MongoDB backend.

My date is: 1992-09-14T21:00:00.000Z

When I use:

<input ui-date ng-model="user.birthDate">

The date is set to 2021, not to 1992. Is there a reason for that?

@alexanderchan
Copy link
Contributor

This works in the current version 1.0.0

      angular.module('MyApp', ['ui.date'])
      .controller('MyCtrl', function($scope) {
          $scope.aDate = '1992-09-14T21:00:00.000Z';
          $scope.dateOptions = {
             dateFormat: 'dd.mm.yy',
          }
      })

@anonrig
Copy link
Author

anonrig commented Mar 3, 2016

@alexanderchan

screen shot 2016-03-03 at 9 08 32 pm

My date options are:

$scope.dateOptions = {
        dateFormat: 'dd.mm.yy'
    };

My html is:

<div class="field">
                    <label> Doğum Tarihi </label>
                    <input ui-date="dateOptions" ng-model="user.birthDate">

                    {{user.birthDate}}
                </div>

It doesn't get updated in the view.

@alexanderchan
Copy link
Contributor

Try changing to a new Date(valuefromdb) first if your string doesn't match the date format.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants