tabuckner / material-dayjs-adapter

A MatDateAdapter for Dayjs
https://www.npmjs.com/package/@tabuckner/material-dayjs-adapter
15 stars 23 forks source link

Update package to Angular 9 #6

Closed chilikla closed 4 years ago

chilikla commented 4 years ago

Hi, Thanks you for this great package. It has been very helpful for me. I updated my project to Angular 9, and I received an error from ng build for wrong importing the DateAdapter, since it should be imported from @angular/material/core now.

ERROR in node_modules/@tabuckner/material-dayjs-adapter/lib/adapter/dayjs-date-adapter.d.ts:2:29 - error TS2306: File '.../node_modules/@angular/material/index.d.ts' is not a module.

2 import { DateAdapter } from '@angular/material';

Can you please update the package in NPM to support it?

tabuckner commented 4 years ago

@chilikla thank you for your support!

I'll work on this today and notify you when the new version is published 😄

tabuckner commented 4 years ago

@chilikla Just wanted to let you know that some progress has been made, although I'm taking this opportunity to integrate some schematics work.

The change on Angular Material that you've called out (thank you by the way :) ) is significant enough that it would be nice to offer an ng-update command for users Migrating to Angular 9.

If you're interested in tracking the progress you can keep an eye on this branch: https://github.com/tabuckner/material-dayjs-adapter/tree/schematics

tabuckner commented 4 years ago

@chilikla Just wanted to let you know that v1.0.0 was just published.

I'd love for you to check it out and let me know if it works in your project now 😄

Thanks!

chilikla commented 4 years ago

Hi @tabuckner ,

Thank you for the quick response! I updated the package to version 1.0.0 and it works without any errors now. Anyway, Angular CLI is posting this warning every build of my project

Warning: Entry point '@tabuckner/material-dayjs-adapter' contains deep imports into
'.../node_modules/dayjs/plugin/utc',
'.../node_modules/dayjs/plugin/localeData',
'.../node_modules/dayjs/plugin/localizedFormat',
'.../node_modules/dayjs/plugin/customParseFormat'.
This is probably not a problem, but may cause the compilation of entry points to be out of order.

Just FYI.

And thanks again for the your support!

tabuckner commented 4 years ago

@chilikla I missed your reply--thats my fault. I apologize.

I took a look at the warnings that the CLI is throwing and there are a few other projects reporting the same messaging.

https://github.com/angular/angular/issues/35615 https://github.com/angular/angular/issues/35750

Dayjs is a peer dependency of this project--and I'm not sure of an immediate work around. My gut tells me there is a different/better way to handle the imports.

I'll take a deeper look soon. :)

ranyehushua commented 4 years ago

I was still getting the issue initially described in this post after upgrading my project to angular 9 @tabuckner

I created this PR: https://github.com/tabuckner/material-dayjs-adapter/pull/16

Seems to have solved the issue after upgrade to material 9 and does not seem to break anything with material 8, let me know what you think.

Thanks so much!

tabuckner commented 4 years ago

@ranyehushua I actually removed v.1.0.0 from NPM which would PROOOOBABLY be why it wasn't working 😂.

I got your PR and will get it merged into the appropriate place. Because Angular Material 9 came with some breaking changes (namely the import path you've pointed out in the PR) we'll want to make sure we have a new release with the correct version number.

Working on this now 😄

ranyehushua commented 4 years ago

You are awesome @tabuckner , thank you so much!

tabuckner commented 4 years ago

no u. @ranyehushua 😜

Took me a minute to get the CD process sorted out, but there's now a @next channel on the NPM package.

The angular 9 compatible version was just published on that tag, you should be able to grab it with:

npm i @tabuckner/material-dayjs-adapter@next

or

yarn add @tabuckner/material-dayjs-adapter@next

I've not tested it very much though--if you could help me out with that @ranyehushua that would be AWESOME!

a link to the release just in case: https://www.npmjs.com/package/@tabuckner/material-dayjs-adapter/v/2.0.0-next.2

tabuckner commented 4 years ago

@chilikla :point_up:

ranyehushua commented 4 years ago

So far so good! Thanks @tabuckner, build works now and functionality is looking great. I will let you know if anything else comes up. Thanks!