Skip to content

DayOfWeek type no longer importable from @internationalized/date after 3.12.1 #9971

@csprle

Description

@csprle

Provide a general summary of the issue here

DayOfWeek type ('sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat') is no longer importable from @internationalized/date as of 3.12.1, despite being used in the public signatures of startOfWeek, endOfWeek, and getDayOfWeek.

🤔 Expected Behavior?

DayOfWeek should be importable from @internationalized/date since it appears directly in the public API and consumers need it to type their own firstDayOfWeek props.

😯 Current Behavior

import { type DayOfWeek } from '@internationalized/date';
// TS error: '"@internationalized/date"' has no exported member named 'DayOfWeek'.

💁 Possible Solution

Export DayOfWeek from queries.ts and re-export it from index.ts:

// queries.ts
export type DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';

// index.ts
export type { DayOfWeek } from './queries';

🔦 Context

DayOfWeek appears in the public signatures of exported functions:

startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue
endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue
getDayOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number

Consumers who accept firstDayOfWeek as a prop and forward it to these functions need to type that prop. Without an exported DayOfWeek there is no canonical type — users must either duplicate the string union or derive it unsafely.

🖥️ Steps to Reproduce

  1. Install @internationalized/date@3.12.1
  2. Add import { type DayOfWeek } from '@internationalized/date' to any TypeScript file
  3. TypeScript reports: Module '"@internationalized/date"' has no exported member named 'DayOfWeek'

Was working in 3.12.0.

Version

@internationalized/date: 3.12.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions