Skip to content

Commit 4d0f790

Browse files
committed
fix: forgot to commit readme
1 parent 61b536b commit 4d0f790

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ So, a relative date phrase is used for up to a month and then the actual date is
8080
| `month` | `month` | `'numeric'\|'2-digit'\|'short'\|'long'\|'narrow'\|undefined` | <sup>***</sup> |
8181
| `year` | `year` | `'numeric'\|'2-digit'\|undefined` | <sup>****</sup> |
8282
| `timeZoneName` | `time-zone-name` | `'long'\|'short'\|'shortOffset'\|'longOffset'` `\|'shortGeneric'\|'longGeneric'\|undefined` | `undefined` |
83+
| `timeZone` | `time-zone` | `string\|undefined` | Browser default time zone |
8384
| `noTitle` | `no-title` | `-` | `-` |
8485

8586
<sup>*</sup>: If unspecified, `formatStyle` will return `'narrow'` if `format` is `'elapsed'` or `'micro'`, `'short'` if the format is `'relative'` or `'datetime'`, otherwise it will be `'long'`.
@@ -139,6 +140,19 @@ The `duration` format will display the time remaining (or elapsed time) from the
139140
- `4 hours`
140141
- `8 days, 30 minutes, 1 second`
141142

143+
##### time-zone (`string`)
144+
145+
The`time-zone` attribute allows you to specify the IANA time zone name (e.g., `America/New_York`, `Europe/London`) used for formatting the date and time.
146+
147+
You can set the time zone either as an attribute or property:
148+
```html
149+
<relative-time datetime="2024-06-01T12:00:00Z" ... time-zone="America/New_York">
150+
June 1, 2024 8:00am EDT
151+
</relative-time>
152+
```
153+
154+
If the individual element does not have a `time-zone` attribute then it will traverse upwards in the tree to find the closest element that does, or default the `time-zone` to the browsers default.
155+
142156
###### Deprecated Formats
143157

144158
###### `format=elapsed`

0 commit comments

Comments
 (0)