jfmdev / ngComboDatePicker

Angular directive to select dates using combo boxes
Mozilla Public License 2.0
23 stars 20 forks source link

sending every time -1 hour #17

Closed olekpuchka closed 7 years ago

olekpuchka commented 7 years ago

Hello, There is an issue with cutting -1h every time when saving data.

Scenario: 1) Sent request to back-end got response, example: image there is dateOfBirht with time 06:05:41 2) Then i didn't change anything and just save and sent it back to back-end, but in request time is cuted into 05:05:41 3) Every time when i do the same steps time cutting with -1h , and we can reach the previous day -1day if do it many times.

I used in html this:

<ng-combo-date-picker
                  ng-model="vm.data.dateOfBirth"
                  ng-date="{{ vm.data.dateOfBirth.toString() }}"
                  ng-min-date="1900-01-02"
                  ng-max-date="2020-12-31"
                  ng-order="mdy"
                  ng-year-order="desc"
                  ng-attrs-date='{"class": "form-control data-picker-select"}'
                  ng-attrs-month='{"class": "form-control data-picker-select"}'
                  ng-attrs-year='{"class": "form-control data-picker-select"}'
                  ng-months="{{ 'MONTHS_LIST' | translate }}" >
                </ng-combo-date-picker>

Can you help ?

Thanks.

jfmdev commented 7 years ago

Hello,

If your model is not null, then you don't need to define the attribute ng-date, so you should remove the line ng-date="{{ vm.data.dateOfBirth.toString() }}" (the date picker will still correctly initialise with ng-model).

If this do not resolve the issue, then I would like to know: 1) in which timezone is the client, 2) the back-end's timezone and 3) the code you use to read the date from the backend (an Ajax call maybe?).

Regards

jfmdev commented 7 years ago

Closed due to inactivity