Skip to content

feat(core): Calendar weekStartsOn accepts three-letter day names#3257

Merged
cixzhang merged 1 commit into
facebook:mainfrom
durvesh1992:fix/calendar-weekstartson-names
Jun 30, 2026
Merged

feat(core): Calendar weekStartsOn accepts three-letter day names#3257
cixzhang merged 1 commit into
facebook:mainfrom
durvesh1992:fix/calendar-weekstartson-names

Conversation

@durvesh1992

Copy link
Copy Markdown
Contributor

Summary

Calendar's weekStartsOn only accepted a numeric 06, which isn't self-documenting at the call site (#2843). It now also accepts a three-letter day name ('sun''sat', case-insensitive):

<Calendar weekStartsOn="mon" />   // same as weekStartsOn={1}
  • Numbers keep working unchanged — the union is a pure superset, so it's non-breaking.
  • The value is normalized to a numeric DayOfWeek at the component boundary, so all downstream date math is untouched.
  • Adds an exported DayOfWeekName type and a small pure normalizeDayOfWeek helper in utils/dateTypes (also re-exported from Calendar).
  • Unrecognized strings fall back to 0 (Sunday).

Test plan

  • normalizeDayOfWeek unit tests: numeric passthrough, all 7 names → index, case-insensitivity, unknown → 0.
  • Calendar render tests: weekStartsOn="mon" and "WED" produce the same first column header as the numeric equivalents. 36/36 tests pass across both files.
  • tsc --noEmit clean (0 errors); updated prop JSDoc + Calendar.doc.mjs (EN/ZH/dense).

Closes #2843

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 30, 2026

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a good improvement for making the option more readable when written

@cixzhang cixzhang merged commit cac8ed5 into facebook:main Jun 30, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

2 participants