Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registry functions: add :date and :time #51

Merged
merged 9 commits into from
Apr 30, 2024

Conversation

ryzokuken
Copy link
Member

Fix an error with :dateTime
Refactor parts of :dateTime
Add :date

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated
Comment on lines 329 to 330
1. Let _inputOptions_ be ? Get(_input_, *"options"*).
1. Perform ? Call(Object.assign, *undefined*, « _opts_, _inputOptions_ »).
Copy link
Member

Choose a reason for hiding this comment

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

Option resolution should happen after value resolution, as it could fail and it has external visibility.

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated
1. Let _valueOf_ be ? Get(_input_, *"valueOf"*).
1. If InstanceOfOperator(_input_, �te%) is *false* and IsCallable(_valueOf_) is *true*, set _input_ to Call(_valueOf_, _input_).
1. If Type(_input_) is Number or String, let _value_ be ? Construct(�te%, « _input_ »).
1. Else if Type(_input_) is Object, let _value_ be _input_.
Copy link
Member

Choose a reason for hiding this comment

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

If the previous steps were to work on value and not input, this line would be unnecessary.

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
@ryzokuken
Copy link
Member Author

@eemeli PTAL now. Regarding the first set of changes, I didn't entirely understand your comments (I think? I could be positively surprised) but I made some improvements that might address your concern.

In the second set of changes, your comment made me realize that I was misreading the code? Sorry for that, the updated spec should make a lot more sense.

spec.emu Outdated Show resolved Hide resolved
Copy link
Member

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Looks good, if we include the one refactor proposed inline.

spec.emu Outdated Show resolved Hide resolved
@ryzokuken
Copy link
Member Author

Overall looks good to me, although I still feel like we could avoid repeating the if (input.options) {...} part while keeping the rest as-is.

@ryzokuken ryzokuken changed the title Registry functions: add :date Registry functions: add :date and :time Apr 29, 2024
@ryzokuken
Copy link
Member Author

@eemeli this might look better now :D

Copy link
Member

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Yup, looks good!

@eemeli eemeli merged commit cdad441 into tc39:main Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants