Skip to content

Commit 1cec7ae

Browse files
authored
Merge pull request #230 from RHElements/feature/add-unixtimestamp-support-to-datetime
Add support for unix timestamps.
2 parents fd2b033 + d4d1406 commit 1cec7ae

File tree

9 files changed

+368
-288
lines changed

9 files changed

+368
-288
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/demo/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ <h3>Local</h3>
5353
Mon Jan 2 15:04:05 EST 2006
5454
</rh-datetime>
5555
</p>
56+
<p>
57+
<strong>Just date (unix timestamp):</strong>
58+
<rh-datetime
59+
id="simpleUnixtime"
60+
timestamp="1136171045"
61+
type="local"
62+
day="numeric"
63+
month="long"
64+
year="numeric">
65+
Mon Jan 2 15:04:05 EST 2006
66+
</rh-datetime>
67+
68+
</p>
5669
<p>
5770
<strong>With time: </strong>
5871
<rh-datetime

elements/rh-datetime/rh-datetime.js

Lines changed: 32 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elements/rh-datetime/rh-datetime.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elements/rh-datetime/rh-datetime.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)