1

I am using angular bootstrap datepicker. Everythings works fine but when I select any date like 20-march-2015 it showing me 19-march-2015(one day less from selected day). Here is my code in Plunker

Rajeev
  • 1,053
  • 4
  • 12
  • 30

2 Answers2

1

This is a daylight saving issue.

Do you get the same issue with dates in February.

Looking at your example you can see the date is

OutPut: "2015-04-26T23:00:00.000Z"

For today :)

if I select 1st Jan, I get

OutPut: "2015-01-01T00:00:00.000Z"

Change your SPAN to

   <span>OutPut: {{formData.dueDate | date : 'dd/MM/yyyy'}}</span>

And your good ( note the | date : 'dd/MM/yyyy' )

Steve Drake
  • 1,968
  • 2
  • 19
  • 41
0

Actually you don't need datepicker. Delete datepicker and use type="date".

<input ng-model="formData.dueDate" type="date" id="dueDate" name="dueDate"
      class="form-control"  ng-click="data.isOpen = true">

Example

hurricane
  • 6,521
  • 2
  • 34
  • 44
  • Actually this is not all browser compatible. Not working on Mozilla and OS linux. – Rajeev Apr 27 '15 at 13:47
  • Maybe this answer will help you : http://stackoverflow.com/questions/18061757/angular-js-and-html5-date-input-value-how-to-get-firefox-to-show-a-readable-d – hurricane Apr 27 '15 at 14:12
  • The example uses bootstrap, the down arrow that BOOT uses is not the same as the one that comes with your .. well my browser :) – Steve Drake Apr 27 '15 at 14:21