Skip to content

Commit

Permalink
fix: ignore browser timezone when parsing selected value
Browse files Browse the repository at this point in the history
Close #59
  • Loading branch information
flang authored and javier-godoy committed Jun 13, 2023
1 parent 13a06cc commit 70449b9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export class InlineDatePicker extends LitElement {

willUpdate(changedProperties) {
if (changedProperties.has('value')) {
this.date = this.value ? new Date(this.value) : undefined;;
this.date = this.value ? new Date(this.value) : undefined;
if(this.date){
// normalize date ignoring browser timezone
this.date = new Date(this.date.toISOString().slice(0, -1));
}
}
if (changedProperties.has('date')) {
this.value = this.date ? this.date.toISOString().substring(0,10) : undefined;
Expand Down

0 comments on commit 70449b9

Please sign in to comment.