@kteneyck/cesium-timeline-react 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -2
- package/dist/cesium-timeline-react.js +770 -753
- package/dist/cesium-timeline-react.umd.cjs +4 -4
- package/dist/index.d.ts +6 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
123
123
|
- **Auto-scroll during playback** — visible window pans automatically when the needle reaches 10% from either edge.
|
|
124
124
|
- **Infinite scrolling window** — timeline is not clamped to `startTime`/`endTime`; the window can pan anywhere.
|
|
125
125
|
- **Adaptive tick labels** — label granularity adapts to zoom level: milliseconds → seconds → HH:MM:SS → HH:MM → Month Day → Month Year → Year. Tick dates are shown only when the visible window spans more than 24 hours.
|
|
126
|
-
- **
|
|
126
|
+
- **Configurable timezone** — tick labels and the datetime display can show any IANA timezone (e.g. `"UTC"`, `"America/New_York"`) or the browser's local time. A short abbreviation (e.g. `UTC`, `EST`, `PDT`) is displayed to the right of the date line whenever a non-local timezone is active.
|
|
127
127
|
- **Netflix/Hulu-style controls** — transport buttons (⏮ ◀◀ ▶/⏸ ▶▶ ⏭) always stay centered; speed badge and LIVE button in the left column never cause layout shift.
|
|
128
128
|
- **Conditional start/end buttons** — ⏮ and ⏭ are only rendered when `startTime` and `endTime` props are explicitly provided.
|
|
129
129
|
- **Speed cycling** — FF cycles through `ffSpeeds` (default `2×→4×→8×→16×→32×→1×`); RW cycles through `rwSpeeds` (default `−1×→−2×→−4×→−8×→−16×→−32×`). Both arrays are fully configurable.
|
|
@@ -159,6 +159,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
159
159
|
| `ffSpeeds` | `number[]` | `[2,4,8,16,32,1]` | Speed steps cycled by the ▶▶ button. Last entry wraps back to first. |
|
|
160
160
|
| `rwSpeeds` | `number[]` | `[1,2,4,8,16,32]` | Absolute-value speed steps cycled by the ◀◀ button (negated internally). |
|
|
161
161
|
| `dateTimeFormat` | `string` | `'MMM DD YYYY HH:mm:ss'` | Token-based format string for the controls datetime display |
|
|
162
|
+
| `timezone` | `string` | browser local | IANA timezone name (e.g. `'UTC'`, `'America/New_York'`) or `'local'` for the browser's timezone. Controls both tick labels and the datetime display. When set, a short abbreviation (e.g. `UTC`, `EST`) appears to the right of the date. |
|
|
162
163
|
| `onDateTimeClick` | `() => void` | — | Called when the user clicks the datetime display. Use to open your own date picker. |
|
|
163
164
|
| `jumpToTime` | `JulianDate \| Date` | — | Set to programmatically jump the timeline to a moment (pans canvas + sets time). |
|
|
164
165
|
| `theme` | `Partial<TimelineTheme>` | `defaultTheme` | Theme overrides (merged with defaults) |
|
|
@@ -229,6 +230,60 @@ const theme = useMemo(() => {
|
|
|
229
230
|
|
|
230
231
|
---
|
|
231
232
|
|
|
233
|
+
## Timezone
|
|
234
|
+
|
|
235
|
+
By default the timeline displays all times in the **browser's local timezone**. Pass the `timezone` prop to use UTC or any [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) instead.
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
// UTC
|
|
239
|
+
<Timeline clock={viewer.clock} timezone="UTC" ... />
|
|
240
|
+
|
|
241
|
+
// A named IANA zone
|
|
242
|
+
<Timeline clock={viewer.clock} timezone="America/New_York" ... />
|
|
243
|
+
|
|
244
|
+
// Back to local (or simply omit the prop)
|
|
245
|
+
<Timeline clock={viewer.clock} timezone="local" ... />
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Both the **canvas tick labels** and the **control bar datetime display** update to reflect the chosen timezone. When a non-local timezone is active a short abbreviation (e.g. `UTC`, `EST`, `PDT`) is shown to the right of the date line. The abbreviation is DST-aware — it automatically switches between `EST` and `EDT`, `PST` and `PDT`, etc.
|
|
249
|
+
|
|
250
|
+
### `Timezones` constants
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import { Timezones } from '@kteneyck/cesium-timeline-react';
|
|
254
|
+
|
|
255
|
+
<Timeline timezone={Timezones.UTC} ... /> // "UTC"
|
|
256
|
+
<Timeline timezone={Timezones.LOCAL} ... /> // "local" (default behavior)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### `getTimezoneAbbr` utility
|
|
260
|
+
|
|
261
|
+
Returns the short abbreviation for a given date and timezone, or `null` for local.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import { getTimezoneAbbr } from '@kteneyck/cesium-timeline-react';
|
|
265
|
+
|
|
266
|
+
getTimezoneAbbr(new Date(), 'UTC'); // → "UTC"
|
|
267
|
+
getTimezoneAbbr(new Date(), 'America/Chicago'); // → "CDT" or "CST"
|
|
268
|
+
getTimezoneAbbr(new Date()); // → null (local)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### `formatDateTime` with timezone
|
|
272
|
+
|
|
273
|
+
The `formatDateTime` utility accepts an optional third argument:
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import { formatDateTime, DateTimeFormats } from '@kteneyck/cesium-timeline-react';
|
|
277
|
+
|
|
278
|
+
formatDateTime(new Date(), DateTimeFormats.ISO, 'UTC');
|
|
279
|
+
// → "2026-02-24 14:04:07" (always in UTC regardless of local browser timezone)
|
|
280
|
+
|
|
281
|
+
formatDateTime(new Date(), DateTimeFormats.DEFAULT, 'America/Los_Angeles');
|
|
282
|
+
// → "Feb 24 2026 06:04:07"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
232
287
|
## DateTime Format
|
|
233
288
|
|
|
234
289
|
The `dateTimeFormat` prop controls the two-line datetime display in the control bar. It accepts a token-based format string.
|
|
@@ -385,7 +440,9 @@ import {
|
|
|
385
440
|
```tsx
|
|
386
441
|
import {
|
|
387
442
|
DateTimeFormats, // Format string presets
|
|
388
|
-
|
|
443
|
+
Timezones, // { LOCAL: 'local', UTC: 'UTC' } convenience constants
|
|
444
|
+
formatDateTime, // Token-based date formatter (date, format, timezone?)
|
|
445
|
+
getTimezoneAbbr, // Short timezone abbreviation for a date (date, timezone?)
|
|
389
446
|
splitForDisplay, // Split format string into time/date parts
|
|
390
447
|
toJulianDate, // Convert Date | JulianDate → JulianDate
|
|
391
448
|
toDate, // Convert Date | JulianDate → Date
|