Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

fix(datetime): $d supports key format object (#1502) #1569

Merged
merged 1 commit into from
Oct 30, 2022

Conversation

horitaka
Copy link
Contributor

@horitaka horitaka commented Oct 29, 2022

This PR is a fix for the issue #1502.

What was fixed

  • $d supports key format object like $n

How it was fixed

  • Add a new logic to parse the $d parameter and handled it as options for Intl.DateTimeFormat. The logic is the same as $n.
  • Add a new test case for key format object.

Result

$d(datetime, {year: '2-digit'}) returns correct value.

スクリーンショット 2022-10-29 22 37 01

スクリーンショット 2022-10-29 22 37 14

@horitaka horitaka changed the title fix(datetime): support key format object (#1502) fix(datetime): $d supports key format object (#1502) Oct 29, 2022
Copy link
Owner

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!
That's a great contribution!

Thank you so much!

@kazupon kazupon added the Type: Feature Includes new features label Oct 30, 2022
@kazupon kazupon merged commit e324286 into kazupon:v8.x Oct 30, 2022
@pr-triage pr-triage bot added the PR: merged label Oct 30, 2022
@horitaka horitaka deleted the fix/issue1502 branch October 30, 2022 13:51
'minute',
'second',
'timeZoneName'
]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this misses these options

timeZone: 'Asia/Shanghai',
// Force 12-hour or 24-hour
hour12: true | false,

// Rarely-used options
hourCycle: 'h11' | 'h12' | 'h23' | 'h24',
formatMatcher: 'basic' | 'best fit'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@majdkhasib Sorry for missing some options... and thank you for your fix commit!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants