-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Order of plugin extends breaks plugin functions #2027
Comments
As a basic pattern, plugins create a chain of function calls for overwritten / extended functions (like Some plugins depend on other plugins. In that case this is part of the documentation and means that the dependant plugin must be
Perhaps you want to create a PR in the docu repo? |
Maybe we can update the logic something like this
to fix this issue? btw, @BePo65 , do you mind taking a look at a minor update in the comments in #1914 so that we can get it merged? |
I am afraid that this will not work, as the class We could add something like this to the start of the initialization of the objectSupport plugin:
but IMHO two plugins should not directly reference each other. And wouldn't we have also do this for plugins that depend on other plugins? Although nobody reads the documentation 😄 I would simply update the documentation (where this consequence is not documented until today). BTW: there a few pr for the documentation website that are perhaps worth a little bit of your time - shouldn't be too much work to review them 😃 |
It could be possible. cause in ObjectSupport plugin, it will check if the argument is an object, all we have to do, is to add a property to the passed object in Duration plugin so that the logic |
while fixing, an issue wit the handling of subtract appeared and was fixed too.
while fixing, an issue wit the handling of subtract appeared and was fixed too.
Of course it would be possible, but IMO objectSupport should not know anything about other plugins it does not depend on. I think I found a solution that does respect this requirement. I created pr #2038 for this. |
fixed via #2038 |
## [1.11.6](iamkun/dayjs@v1.11.5...v1.11.6) (2022-10-21) ### Bug Fixes * add BigIntSupport plugin ([iamkun#2087](iamkun#2087)) ([f6dce48](iamkun@f6dce48)) * Fix objectSupport collides with Duration plugin - issue [iamkun#2027](iamkun#2027) ([iamkun#2038](iamkun#2038)) ([c9370ea](iamkun@c9370ea))
## [1.11.6](iamkun/dayjs@v1.11.5...v1.11.6) (2022-10-21) ### Bug Fixes * add BigIntSupport plugin ([#2087](iamkun/dayjs#2087)) ([f6dce48](iamkun/dayjs@f6dce48)) * Fix objectSupport collides with Duration plugin - issue [#2027](iamkun/dayjs#2027) ([#2038](iamkun/dayjs#2038)) ([c9370ea](iamkun/dayjs@c9370ea))
Describe the bug
I'm trying to use two plugins (duration and objectSupport) in my Angular app. While using datejs#add function with argument of type Duration (implemented in duration plugin), I get Invalid Date if the plugin objectSupport is extended after the duration plugin. If objectSupport is extended before the duration plugin then add method works fine.
Demo
CodeSandbox link https://codesandbox.io/s/festive-sutherland-thxuux?file=/src/app/app.module.ts
In app.module.ts, change the order of lines 10 and 11, and look at console after refreshing Browser preview tab.
Expected behavior
No matter the order of plugin extends, all plugin functions should work as expected.
Information
The text was updated successfully, but these errors were encountered: