Skip to content

Fix from and with method types of Temporal.PlainMonthDay#63142

Merged
jakebailey merged 1 commit intomicrosoft:mainfrom
fabon-f:fix-temporal-pmd
Feb 17, 2026
Merged

Fix from and with method types of Temporal.PlainMonthDay#63142
jakebailey merged 1 commit intomicrosoft:mainfrom
fabon-f:fix-temporal-pmd

Conversation

@fabon-f
Copy link
Contributor

@fabon-f fabon-f commented Feb 15, 2026

Fixes #60164, follow-up PR of #62628 (based on #62628 (comment)).

Temporal.PlainMonthDay.from (and Temporal.PlainMonthDay.prototype.with) accepts a pair of era and eraYear as well as year.

Temporal.PlainMonthDay.from({ month: 6, day: 15, era: "am", eraYear: 5779, calendar: "hebrew" });
// PlainMonthDay corresponding to "1970-02-21[u-ca=hebrew]"

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 15, 2026
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Feb 15, 2026
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@fabon-f
Copy link
Contributor Author

fabon-f commented Feb 15, 2026

@microsoft-github-policy-service agree

@fabon-f fabon-f changed the title Fix Temporal.MonthDayLikeObject type Fix from and with method types of Temporal.PlainMonthDay Feb 15, 2026
nanoseconds?: number | undefined;
}

interface MonthDayLikeObject extends Omit<DateLikeObject, "era" | "eraYear"> {}
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually think it'd be good to leave this type and just assign it to DateLikeObject. Then, if a future TS manages to describe the complexity of Temporal's types then existing users who've imported MonthDayLikeObject will automatically pick up the more accurate rules.

Copy link
Member

@jakebailey jakebailey Feb 17, 2026

Choose a reason for hiding this comment

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

Is that possible without a break? This is an interface type, so at most we can add more properties to it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, good point. In that case, then this change is fine.

readonly monthCode: string;
readonly day: number;
with(monthDayLike: PartialTemporalLike<MonthDayLikeObject>, options?: OverflowOptions): PlainMonthDay;
with(monthDayLike: PartialTemporalLike<DateLikeObject>, options?: OverflowOptions): PlainMonthDay;
Copy link
Contributor

Choose a reason for hiding this comment

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

Per comment above, I wouldn't change this.

@github-project-automation github-project-automation bot moved this from Not started to Needs merge in PR Backlog Feb 17, 2026
@jakebailey jakebailey added this pull request to the merge queue Feb 17, 2026
Merged via the queue into microsoft:main with commit 0ed1ee5 Feb 17, 2026
23 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Feb 17, 2026
@fabon-f fabon-f deleted the fix-temporal-pmd branch February 17, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add Temporal (Stage 3) types

4 participants