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

google Closure-ify js-joda and add as a :lib in this library #12

Closed
henryw374 opened this issue Jun 2, 2020 · 2 comments
Closed

google Closure-ify js-joda and add as a :lib in this library #12

henryw374 opened this issue Jun 2, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@henryw374
Copy link
Owner

henryw374 commented Jun 2, 2020

this might be a better alternative to proposal tempora (see #11 )l: the api already matches and it is available right now.

this would involve a source transpilation of js-joda. not totally sure how feasible, but if it can be done, it shouldn't be too much work.

if it can be done, I don't see any tech blockers to this lib becoming accepted as the core time lib for the clojure ecosystem

ideally then, the locale api would use the in-built Intl api, not js-joda locale packages. tz db could be optional and DCE friendly - if you know ahead of time what zone info you want

@henryw374
Copy link
Owner Author

@henryw374 henryw374 self-assigned this Jul 10, 2020
@henryw374 henryw374 added the enhancement New feature or request label Jul 10, 2020
@henryw374 henryw374 added this to the 1.0 milestone Jul 10, 2020
@henryw374
Copy link
Owner Author

Having put significant time into making js-joda amenable to Dead Code Elimination, I have decided to shelve the effort for now. The reasons for this are:

My experiments show Google Closure does not fully eliminate unused js-joda code in many cases. I guess it can’t analyze the code well enough and has to play safe. If the cljs app doesn’t use js-joda at all, then none of js-joda is included, but that’s not the extent of DCE I was hoping for.
The js-joda add-on libs (timezone and locale) would need to be completely reworked to be DCE friendly - and I’m not 100% sure that’s possible. If that couldn’t happen, end users would probably have to juggle :exclusions to choose npm or non-npm js-joda - not great.
Temporal is getting closer to reality - maybe shipped in some browsers in 2021? see tc39/proposal-temporal#1079 7.
Further reading:

js-joda PR: js-joda/js-joda#463 4
comparison of Temporal to java.time: http://widdindustries.com/ecma-temporal-vs-java-time/ 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant