Rajeev
Rajeev

Reputation: 1113

Angular Bootstrap datepicker day issue

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

Upvotes: 1

Views: 630

Answers (2)

Steve Drake
Steve Drake

Reputation: 2048

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' )

Upvotes: 1

hurricane
hurricane

Reputation: 6724

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

Upvotes: 0

Related Questions