Skip to content

Conversation

@pzien
Copy link

@pzien pzien commented Jul 18, 2022

No description provided.

@pzien
Copy link
Author

pzien commented Oct 10, 2022

I would like to use the new version with luxon for a lib that depends on this one (date-holidays-parser). I need a new version to be able to create a pull request for that lib.

@commenthol
Copy link
Owner

Hi @pzien,

Thanks for your efforts, [email protected] is now published.

If you like to work on the different packages which are part of the parser I'd
recommend you to take a look at npm workspaces.
This allows you to symlink the different packages without the need of a published version.

I have used lerna in the past, but now use pnpm. All are pretty much similar in their use.

My project structure with the required packages looks like this:

.
├── packages
│   ├── astronomia
│   ├── caldate
│   ├── date-bengali-revised
│   ├── date-chinese
│   ├── date-easter
│   ├── date-holidays
│   └── date-holidays-parser
├── node_modules
└── pnpm-workspace.yaml

In my case a pnpm install will symlink all locally checked out packages.

@mcshaz
Copy link

mcshaz commented Jan 9, 2023

While npm workspaces/pnpm is a workaround for the author of this pull request, is it possible that the collection of libraries/dependencies can be moved away from the deprecated moment library please? Reading all the reasons for the deprecation/no-longer-maintained status of moment, moving to a modern library seems sensible, and as Luxon makes use of the intl.timezone EcmaScript spec, it seems as good a choice as any.
Edit:
Having read further (for example this medium article) it seems currently

  1. Luxon is not good for tree shaking when only a handfull of methods are used (as is the case here). Size can be reduced slightly when importing 'luxon/src/luxon'.
  2. DayJs (at least version 1) does not use the native ES engine for Intl.DateTime if it is present, which I believe would negate many advantages of changing away from Moment.
  3. Date-fns provides helper methods for the JS native date object, with good tree shaking ability. Time-zone helpers are described here: https://date-fns.org/v2.29.3/docs/Time-Zones
  4. JS-Joda also looks to have small size, performance etc as well. It seems to have a smaller user base.

Anyway, if you pick a library you prefer I am sure we can help refactor the code away from the moment library for the entire workspace you outlined in the comment above.

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.

3 participants