Angular bootstrap datepicker date format does not format ng-model value

后端 未结 13 1354
借酒劲吻你
借酒劲吻你 2020-12-01 04:24

I am using bootstrap date-picker in my angular application. However when I select a date from that date-picker underlying ng-model that I have bind gets updated I want that

13条回答
  •  一生所求
    2020-12-01 05:02

    With so many answers already written, Here's my take.

    With Angular 1.5.6 & ui-bootstrap 1.3.3 , just add this on the model & you are done.

    ng-model-options="{timezone: 'UTC'}" 
    

    Note: Use this only if you are concerned about the date being 1 day behind & not bothered with extra time of T00:00:00.000Z

    Updated Plunkr Here :

    http://plnkr.co/edit/nncmB5EHEUkZJXRwz5QI?p=preview

提交回复
热议问题