akveo / ngx-admin

Customizable admin dashboard template based on Angular 10+
https://akveo.github.io/ngx-admin/
MIT License
25.29k stars 7.96k forks source link

Calender date issue #2021

Open ashwanthrao opened 5 years ago

ashwanthrao commented 5 years ago

Issue type

I'm submitting a ... (check one with "x")

Issue description

Current behavior: In Extra Component->calender I am trying to get date on Onsubmit which will provide the date from the HTML when selecting a data from datepicker. Issue is date is one date back. if i select Jan 31st in component i get jan 30("date1":"2019-01-30T18:30:00.000Z").

Expected behavior: it should show selected date.

Steps to reproduce:

Related code:

.html page below

<button type="button" (click)="onSubmit(Form.value)" style="float: right;" class="btn btn-secondary btn-demo btn-tn" >Save

.component page as below onSubmit(group:any):void{ alert(JSON.stringify(group)); } ### Other information: node --version=v10.0.0 npm --version=6.7.0 OS : ubuntu 16.04 Browser : Firefox
yggg commented 5 years ago

Hi @ashwanthrao! Which version of nebular do you use? Can't see this issue on latest ngx-admin.

ashwanthrao commented 5 years ago

i am using the latest 3.4.0. Find attachment for reference. calendar issue

html code:

on button click (click)="onSubmit(FormEdit.value)"

      <input nbInput placeholder="Form Picker" [nbDatepicker]="formpicker" name="date" value="" ngModel>
      <nb-datepicker #formpicker></nb-datepicker>

component code: onSubmit(date):void{ alert(JSON.stringify(date)); }

ashwanthrao commented 5 years ago

Check previous comments,When we selected march 25th in calendar and alert display march 24th.

khaled-zubaidi commented 2 years ago

facing the same issue!

for anyone interested. I found out the issue is not caused by nebular, when data is selected it's in fact the correct value, but when value was passed to JSON.parse serialization of date become UTC-0 what's why it was behind one day.