Skip to content

Commit

Permalink
feat(input-time-zone): add time zone offset and name mode (#7913)
Browse files Browse the repository at this point in the history
**Related Issue:** #7430 

## Summary

This adds a `mode` property to the component to list:

* Time zone offsets with (searchable) time zone groups
* IANA time zone names

### API changes

```ts
interface InputTimeZone {
  /**
   * Sets the time zone display and value used by the component.
   * 
   * when set to "offset" (default), displays list of time zone offsets
   * when set to "name", displays list of IANA time zone names
   */
  mode: "offset" | "name"; 

  /**
   * The reference date used when processing offsets (affects daylight savings time).
   * When not provided, the reference date will be today's date.
   *  
   * Note: this only affects to the `offset` mode
   */  
  referenceDate: Date | string; 
}
```

### Noteworthy changes

#### `mode="offset"`

* wires up
[`timezone-groups`](https://www.npmjs.com/package/timezone-groups)
package to list cities along with each respective offset entry
* city names are translated
* allows searching by time zone regardless of being displayed in the
label or not
* E2E tests extend `Intl.DateTimeFormat` to patch missing behavior
(limited subset of time zones) from Chromium v92 (bundled w/ Stencil's
Puppeteer v10).
  • Loading branch information
jcfranco authored Oct 3, 2023
1 parent 9c17a37 commit 80bd6ae
Show file tree
Hide file tree
Showing 10 changed files with 515 additions and 109 deletions.
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/calcite-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"focus-trap": "7.5.2",
"form-request-submit-polyfill": "2.0.0",
"lodash-es": "4.17.21",
"sortablejs": "1.15.0"
"sortablejs": "1.15.0",
"timezone-groups": "0.5.0"
},
"devDependencies": {
"@esri/calcite-design-tokens": "1.0.0",
Expand Down
Loading

0 comments on commit 80bd6ae

Please sign in to comment.