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

new lightweight temporal polyfill #2060

Closed
arshaw opened this issue Feb 15, 2022 · 9 comments
Closed

new lightweight temporal polyfill #2060

arshaw opened this issue Feb 15, 2022 · 9 comments

Comments

@arshaw
Copy link
Contributor

arshaw commented Feb 15, 2022

Hello! Thank you so much for this proposal, all the wonderful tests, and for the existing polyfill.

I've made a new Temporal polyfill that has slightly different goals than @js-temporal/polyfill. It targets more modern browsers that have BigInt support. It attempts to have smaller filesize, at the expense of strictness. Nonetheless, it is (or soon will be) spec-compliant, with all tests passing.

README: https://github.com/fullcalendar/temporal/blob/main/packages/temporal-polyfill/README.md
NPM: https://www.npmjs.com/package/temporal-polyfill

It should be considered 'alpha' and requires a bit more work, but wanted to give you a heads up!

@ptomato
Copy link
Collaborator

ptomato commented Feb 15, 2022

Thanks for the info! Would you like to open a PR to add yours to the table in https://github.com/tc39/proposal-temporal#polyfills?

@arshaw
Copy link
Contributor Author

arshaw commented Feb 15, 2022

I will do that! Thank you

@justingrant
Copy link
Collaborator

@arshaw this is great! So exciting to see more polyfills. Was this based on an earlier date library that was adapted to fit the Temporal API, or was it written from scratch to be a Temporal polyfill?

re: passing tests, does your polyfill also pass Test262? There are almost 4000 Temporal tests in test262. The demitasse tests (the jest-like ones you're using in your polyfill repo) are gradually being migrated over to Test262. When they're migrated they're removed from this repo which makes it easy for us to track which ones have been migrated. So if you're only copying tests from this repo then you're missing a bunch of 'em.

In addition to running your polyfill against Test262, you can also try copying tests from the @js-temporal/temporal-polyfill repo instead of this one. The demitasse tests in @js-temporal/temporal-polyfill should include almost all of the original demitasse tests from this repo, before thousands of them were migrated over to Test262.

@justingrant
Copy link
Collaborator

I'm excited to try out your new polyfill! <15K is really impressive and will be very welcome in the community.

@arshaw, you may want to coordinate with @12wrigja who's working on @js-temporal/temporal-polyfill which is what Google will be using internally. There may be an opportunity to collaborate.

re: passing tests, does your polyfill also pass Test262?

I filed fullcalendar/temporal-polyfill#3 to track this.

The demitasse tests in @js-temporal/temporal-polyfill should include almost all of the original demitasse tests from this repo, before thousands of them were migrated over to Test262.

Looks like you're only missing about 300 demitasse tests. I filed fullcalendar/temporal-polyfill#2 to track.

@arshaw
Copy link
Contributor Author

arshaw commented Feb 18, 2022

@justingrant, thanks for the kind reception. My project did indeed start out as a completely different date library, then morphed into a spec-compliant Temporal implementation over time. Though, once we decided on that direction, it essentially required a rewrite. It has been an incredible amount of work.

I've commented on the demitasse test situation and the tests262 situation in the other tickets! Thank you for the pointers. I will need to get both of those systems passing before declaring victory.

@12wrigja, what are your upcoming plans for the js-temporal/temporal-polyfill repo? Mostly optimizations? (seems like it's the only item missing from the roadmap)

@12wrigja
Copy link
Contributor

I've filed js-temporal/temporal-polyfill#138 to capture all my thoughts on roadmaps in the right repo, feel free to comment. I'm definitely interested in persuing how you've achieved <15K and seeing if there's learnings I can apply to the js-temporal/temporal-polyfill codebase, but I'm currently very busy with other work and don't think I'll find the time for a couple weeks or so.

@MohsenAlyafei
Copy link

Is this polyfill available on cdn.jsdelivr for immediate access?

@arshaw
Copy link
Contributor Author

arshaw commented Mar 11, 2022

@MohsenAlyafei I posted a CDN link on the package's README.

Please post future questions/comments on the project's issue tracker

@ptomato
Copy link
Collaborator

ptomato commented May 6, 2022

Thanks for letting us know about the polyfill! It's displayed on the front page of the repo now, so I'll close this.

@ptomato ptomato closed this as completed May 6, 2022
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

No branches or pull requests

5 participants