Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/clear-dates-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tailor-platform/app-shell": patch
---

Correct the DatePicker documentation and migration examples to use `useTimeZone().today()` instead of a standalone `today` import.
Keep date constraints aligned with AppShell's configured timezone, and clarify how to obtain the current date and time without adding public exports.
18 changes: 9 additions & 9 deletions docs-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@
],
"hashes": {
"typeSurface": "a0f5522359e8f81d",
"outline": "3144450969e87c0a",
"outline": "adc21f4e13532e09",
"snapshot": null,
"outputMd": "d4b478c7ba8304d5",
"outputMd": "b7302d55df8907bc",
"examples": null
}
},
Expand Down Expand Up @@ -1130,9 +1130,9 @@
"symbols": [],
"hashes": {
"typeSurface": null,
"outline": "80dfe11d696ce694",
"outline": "e88bb360eb853c34",
"snapshot": null,
"outputMd": "af237de157fd8691",
"outputMd": "19ca77c7802ca5f6",
"examples": null
}
},
Expand Down Expand Up @@ -1773,9 +1773,9 @@
"symbols": [],
"hashes": {
"typeSurface": null,
"outline": "0453e622960d3c3a",
"outline": "44c8aac9cb791bd9",
"snapshot": null,
"outputMd": "30c15545ab3c4954",
"outputMd": "aaf63f2f33d6665e",
"examples": null
}
},
Expand Down Expand Up @@ -1841,7 +1841,7 @@
"packages/core/skills/app-shell-patterns/references/components/command-palette.md": "7e5bc675a593791a",
"packages/core/skills/app-shell-patterns/references/components/csv-importer.md": "53d3c795ca21b9dc",
"packages/core/skills/app-shell-patterns/references/components/data-table.md": "06f3ce2174fda10a",
"packages/core/skills/app-shell-patterns/references/components/date-picker.md": "d4b478c7ba8304d5",
"packages/core/skills/app-shell-patterns/references/components/date-picker.md": "b7302d55df8907bc",
"packages/core/skills/app-shell-patterns/references/components/default-header.md": "375e55f4b12fa2be",
"packages/core/skills/app-shell-patterns/references/components/default-sidebar.md": "9b1672c71b6db3ff",
"packages/core/skills/app-shell-patterns/references/components/description-card.md": "a347fd1f4ccd433e",
Expand Down Expand Up @@ -1896,7 +1896,7 @@
"packages/core/skills/app-shell-patterns/references/api/use-resolved-locale.md": "d0eb9f125c314d85",
"packages/core/skills/app-shell-patterns/references/api/use-route-error.md": "1a44180ec84ce4b9",
"packages/core/skills/app-shell-patterns/references/api/use-theme.md": "c338022de386d5e4",
"packages/core/skills/app-shell-patterns/references/api/use-time-zone.md": "30c15545ab3c4954",
"packages/core/skills/app-shell-patterns/references/api/use-time-zone.md": "aaf63f2f33d6665e",
"packages/core/skills/app-shell-patterns/references/api/use-toast.md": "30983a761bc61593",
"packages/core/skills/app-shell-patterns/references/patterns/form-composer.md": "ed187ac3a0773d3d",
"packages/core/skills/app-shell-patterns/references/patterns/form-modal.md": "a0d3c952b0b10351",
Expand All @@ -1910,7 +1910,7 @@
"packages/core/skills/app-shell-patterns/references/pages/document-collection.md": "e79d9120d86db198",
"packages/core/skills/app-shell-patterns/references/pages/document-detail.md": "e07c7fee2478a21d",
"packages/core/skills/app-shell-patterns/SKILL.md": "18efee79280174e7",
"packages/core/skills/app-shell-upgrade/references/migrations.md": "2b1c0ad9006a3c55",
"packages/core/skills/app-shell-upgrade/references/migrations.md": "9bd2735c34fd35e3",
"packages/core/skills/app-shell-upgrade/SKILL.md": "f9be942f3e596c00"
}
}
37 changes: 23 additions & 14 deletions docs-src/components/date-picker.docs.outline.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import {
Calendar,
RangeCalendar,
Field,
useTimeZone,
// Date value helpers (re-exported from @internationalized/date)
parseDate,
getLocalTimeZone,
today,
type CalendarDate,
type DateValue,
type DateRange,
Expand Down Expand Up @@ -89,19 +88,29 @@ A `DateField` with a calendar popover.

Constrained + unavailable dates:

Use [`useTimeZone()`](../api/use-time-zone.md) to obtain today's date in AppShell's configured timezone, rather than calculating against the browser's timezone directly.

```tsx
<label id="delivery-date-label" htmlFor="delivery-date">
Delivery date
</label>
<DatePicker
id="delivery-date"
aria-labelledby="delivery-date-label"
minValue={today(getLocalTimeZone())}
isDateUnavailable={(date) => {
const dow = date.toDate(getLocalTimeZone()).getDay();
return dow === 0 || dow === 6; // weekends
}}
/>
function DeliveryDatePicker() {
const timeZone = useTimeZone();

return (
<>
<label id="delivery-date-label" htmlFor="delivery-date">
Delivery date
</label>
<DatePicker
id="delivery-date"
aria-labelledby="delivery-date-label"
minValue={timeZone.today()}
isDateUnavailable={(date) => {
const dow = date.toDate("UTC").getUTCDay();
return dow === 0 || dow === 6; // weekends
}}
/>
</>
);
}
```

Week start:
Expand Down
14 changes: 10 additions & 4 deletions docs-src/guides/migrations.docs.outline.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,27 +167,33 @@ The date controls now follow the same composition model as `Field`, `Select`, `C

TypeScript will error on the removed props; delete them and compose with `Field.Root` instead.

Both examples use `useTimeZone()` at the top level of the component so the minimum date follows AppShell's configured timezone.

Before:

```tsx
const timeZone = useTimeZone();

<DatePicker
label="Delivery date"
description="When should we ship your order?"
minValue={today(getLocalTimeZone())}
minValue={timeZone.today()}
errorMessage={error}
isInvalid={!!error}
/>
/>;
```

After:

```tsx
const timeZone = useTimeZone();

<Field.Root invalid={!!error}>
<Field.Label>Delivery date</Field.Label>
<DatePicker aria-label="Delivery date" minValue={today(getLocalTimeZone())} />
<DatePicker aria-label="Delivery date" minValue={timeZone.today()} />
<Field.Description>When should we ship your order?</Field.Description>
<Field.Error match={!!error}>{error}</Field.Error>
</Field.Root>
</Field.Root>;
```

`isInvalid` remains a top-level prop for externally-controlled invalid styling. Semantic date props (`isRequired`, `isDisabled`, `isReadOnly`, `minValue`, `maxValue`, `isDateUnavailable`) remain top-level and unchanged. Standalone usage still works with an accessible name:
Expand Down
4 changes: 4 additions & 0 deletions docs-src/hooks/use-time-zone.docs.outline.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ React hook that returns a `TimeZone` object for the timezone configured on `AppS

Date/time components (`DateField`, `DatePicker`, `Calendar`) consume this hook automatically — use it when you need the same timezone in custom components.

For the current date or time in React components, use `timeZone.today()` or `timeZone.now()` rather than importing standalone `today` or `now` helpers from AppShell. These methods respect AppShell's `timeZone` setting; calculating against the browser's timezone directly can produce a different date.

Both methods read the current clock when called. They do not schedule re-renders when the date or time changes.

## Signature

```typescript
Expand Down
4 changes: 4 additions & 0 deletions docs/api/use-time-zone.md

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

37 changes: 23 additions & 14 deletions docs/components/date-picker.md

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

14 changes: 10 additions & 4 deletions docs/migrations.md

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

Loading