0

I'm using AngularJS Bootstrap UI Datepicker with moment and moment-timezone. I set an inital date based on given timezone. So Datepicker works well if I set Date object as a ng-model:

$scope.dt = new Date() //works

but if I want to get current time in given timezone nothing shows up in datepicker (here I'm sending string):

$scope.dt = moment(new Date()).tz("Pacific/Auckland").format(); //not working

How can I fix this. Here is plunker

Klark
  • 423
  • 6
  • 16
  • Possible duplicate of [Moment.js: Format date in a specific timezone](https://stackoverflow.com/questions/15347589/moment-js-format-date-in-a-specific-timezone) – NTP Mar 17 '18 at 20:05
  • It's not dublicate, here I now how to get date for specific timezone, but I can't show that date inside datepicker – Klark Mar 17 '18 at 22:59
  • http://plnkr.co/edit/nvjP4T6foMl2J2QpJZPp?p=preview something like this? – G_S Mar 18 '18 at 14:40
  • @G_S great works, didn't know that was a problem in format method...thanks – Klark Mar 18 '18 at 16:39
  • Happy that it worked – G_S Mar 19 '18 at 05:17

0 Answers0