Gillardo / bootstrap-ui-datetime-picker

AngularJs directive to allow use of the bootstrap UI date/time pickers in a single dropdown
MIT License
306 stars 168 forks source link

Configure datetime-picker to use a specific timezone, example Europe/London #203

Open sumit13587 opened 7 years ago

sumit13587 commented 7 years ago

How can we configure datetime-picker to follow timezone of Europe/London (UTC+001)?

We tried the following, which did not work:

<input ng-model="ordersModel.order.orderStartDate" type="text" id="orderStartDate" datetime-picker="MM/dd/yyyy HH:mm" class="form-control" ng-model-options="{timezone: 'Europe/London'}" datepicker-append-to-body="true" is-open="startDateCalendar.isOpen">

vikey913 commented 7 years ago

Guys,

Any update on this ?

jsantos commented 6 years ago

I believe (but I might be wrong) it only supports time zone offsets.

E.g.: ng-model-options="{timezone: 'UTC+02:00'}

I'm having some trouble with this as it's not super accurate for things like Daylight Savings Time (the offset changes twice a year). Moment.js addresses this well (and understands something like 'Europe/London'), which I'm currently trying to integrate with the datetime picker.

Update (from https://docs.angularjs.org/api/ng/filter/date):

Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used.