Skip to content

Commit

Permalink
[demo] Initialize timezone only if it is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
t2ym committed Mar 27, 2019
1 parent 3003bed commit 6234408
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion demo/clock/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ class WorldClock extends LitClock {
connectedCallback() {
super.connectedCallback();
this.__date = new Date();
this.timezone = -this._date.getTimezoneOffset();
if (this.timezone === undefined) {
this.timezone = -this._date.getTimezoneOffset();
}
}

render() {
Expand Down
4 changes: 3 additions & 1 deletion demo/preprocess/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ class WorldClock extends LitClock {
connectedCallback() {
super.connectedCallback();
this.__date = new Date();
this.timezone = -this._date.getTimezoneOffset();
if (this.timezone === undefined) {
this.timezone = -this._date.getTimezoneOffset();
}
}
render() {
return html([
Expand Down

0 comments on commit 6234408

Please sign in to comment.