Skip to content

Commit 1063fbf

Browse files
author
Jason Smith
committed
Adding documentation, and altering timestamp to "local" timezone.
1 parent 1ef1a21 commit 1063fbf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

elements/rh-datetime/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ You can use any locale here.
6565

6666
The value of this should be the same timestamp that you add to the light DOM.
6767

68+
### timestamp (observed)
69+
70+
A unix timestamp that will be converted for use in displaying the appropriate date. You would not use both datetime and timestamp, and the last updated will take precedence.
71+
6872
### type (observed)
6973

7074
The options for type are:

elements/rh-datetime/src/rh-datetime.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ class RhDatetime extends RHElement {
6464

6565
this._timestamp = val;
6666

67-
this.setDate(new Date(val * 1000));
67+
/* Get local timezone offset */
68+
let offset = new Date().getTimezoneOffset() * 60 * 1000;
69+
70+
this.setDate(new Date(val * 1000 + offset));
6871
}
6972

7073
get datetime() {

0 commit comments

Comments
 (0)