danielmoncada / date-time-picker

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

Add Angular 18 support #199

Closed NetWin closed 3 weeks ago

NetWin commented 1 month ago

Changes

NetWin commented 1 month ago

@danielmoncada would you mind checking this out please? :)

andreialecu commented 3 weeks ago

Based on the activity in this repository it may seem like the original maintainer moved on from this project.

@NetWin - I see that you're quite active, so perhaps you can consider maintaining your fork, and we move over there. Just a thought.

NetWin commented 3 weeks ago

Yeah i was thinking about this aswell. I even published a version under my npm scope already.

⚠️ But i did not test it yet ⚠️

andreialecu commented 3 weeks ago

I saw it and tried it.

I ran into https://github.com/danielmoncada/date-time-picker/issues/197 and https://github.com/danielmoncada/date-time-picker/issues/194 when using standalone components, particularly because it couldn't inject the DateAdapter.

I was able to work around it by adding OwlNativeDateTimeModule as an import to one of the remaining top level @NgModules in the app. Would be good to make this work with standalone components directly though, I'm not sure what needs to be done.

NetWin commented 3 weeks ago

That's great! Okay i will take a look later and check what needs to be done to convert the library to standalone / make it work in an angular app that uses standalone components. I'll post here when i have an update. 👍

NetWin commented 3 weeks ago

Yeah i was thinking about this aswell. I even published a version under my npm scope already.

⚠️ But i did not test it yet ⚠️

Edit: We now tested it and it works fine in 4 different Angular applications for us at work.

So if anyone needs it, feel free to use: https://www.npmjs.com/package/@netwin/angular-datetime-picker

If you encounter any problems, feel free to create an issue here: https://github.com/NetWin/date-time-picker

Regarding the issues pointed out above. We imported both the OwlDateTimeModule and the OwlNativeDateTimeModule into the standalone component that uses the date picker. And it works flawlessly.

I think the reason for these issues is that the Date picker does not work with JS Dates out of the Box. It's implemented in a generic way where you import the components via the OwlDateTimeModule and the DateTimeAdapter via the OwlNativeDateTimeModule. If the latter is missing, there is no way for the components to parse your provided dates, throwing an error in the process.

I'm currently working on a full upgrade of this library. (Strictmode, standalone, signals, improved documentation etc.) but this will take some time as i have to get familiar with the codebase first.

danielmoncada commented 3 weeks ago

I'm still here. I will merge this and publish.

I apologize for the absence, been pretty busy at work.

danielmoncada commented 3 weeks ago

published, thank you @NetWin for the PR