danielmoncada / date-time-picker

Angular Date Time Picker (Responsive Design)
https://daniel-projects.firebaseapp.com/owlng/date-time-picker
MIT License
141 stars 61 forks source link

library will not build without Momentjs #77

Closed aldas closed 3 years ago

aldas commented 3 years ago

I would like to build my app without momentjs to reduce bundle size but build fails

ERROR in node_modules/@danielmoncada/angular-datetime-picker/lib/date-time/adapter/moment-adapter/moment-date-time-adapter.class.d.ts:5:24 - error TS2307: Cannot find module 'moment' or its corresponding type declarations.

5 import { Moment } from 'moment';

Even momentjs guys/gals are admitting that there are nicer alternatives

Another common argument against using Moment in modern applications is its size. Moment doesn't work well with modern "tree shaking" algorithms, so it tends to increase the size of web application bundles. If one needs internationalization or time zone support, Moment can get quite large. Modern web browsers (and Node.js) expose internationalization and time zone support via the Intl object, codified as ECMA-402. Libraries like Luxon (and others) take advantage of this, reducing or removing the need to ship your own data files. Recently, Chrome Dev Tools started showing recommendations for replacing Moment for the size alone. We generally support this move.

See https://momentjs.com/docs/#/-project-status/

would it be possible to restructure this library so it will not be a required dependency?

Lonli-Lokli commented 3 years ago

+1 for that

ERROR in The target entry-point "@danielmoncada/angular-datetime-picker" has missing dependencies:

marleypowell commented 3 years ago

I also have that issue. Why is moment not listed as a peer dependency?

Lonli-Lokli commented 3 years ago

I believe that's duplicate of https://github.com/danielmoncada/date-time-picker/issues/20 Workaround is to add to devdeps

danielmoncada commented 3 years ago

duplicate of https://github.com/danielmoncada/date-time-picker/issues/20