Closed Will-at-FreedomDev closed 1 month ago
For Angular 17, you can use the provide*
API
Please check this issue https://github.com/ng-matero/extensions/issues/141 to learn more about the datetime format
For Angular 17, you can use the
provide*
APIPlease check this issue https://github.com/ng-matero/extensions/issues/141 to learn more about the datetime format
Thank you for the quick reply! I will try this today.
Whoops just realized this is my alt account, sorry about the account confusion!
As an update, I tried to use the *provide adapter for the Fns module, but I was seeing the same behavior with error aforementioned. I did not change the parse or display formats from what I posted in the OP, but that could be the issue. They were used fine in Angular 16 so I wouldn't expect to have to change those. Anyway, feel free to close this issue if it's working as you expect; using the NativeDatetimeModule
is a suitable workaround for us.
As an update, I tried to use the *provide adapter for the Fns module, but I was seeing the same behavior with error aforementioned. I did not change the parse or display formats from what I posted in the OP, but that could be the issue. They were used fine in Angular 16 so I wouldn't expect to have to change those. Anyway, feel free to close this issue if it's working as you expect; using the
NativeDatetimeModule
is a suitable workaround for us.
Please give me an online example
@nzbin I tried to create a minimal reproduction, but was not able to. If I happen to figure out what is going on here, I'll let you know. Otherwise, it's likely working as expected and something else such as another library is causing an issue. Thank you!
@nzbin I wanted to give you an update. First of all, my apologies. I see now that on this component where we were having this issue, someone was using the Angular Material mat-*
date picker components instead of mtx-*
. I figure if someone reports a similar issue in the future, this could be the problem.
We are seeing the above error in DevTools when using custom date/time formats. I inspected the date-fns code and it appears that the
dirtyDateFormat
parameter is an object:{ day: "numeric", month: "numeric", year: "numeric" }
, which doesn't seem to be supported by that module. Theo
from the error above is coming from when thedirtyDateFormat
parameter is converting to a string ("[Object object]"
).I think this issue is stemming from the
Mtx-DatetimeModule
s. We were successfully usingMtxDateFnsDatetimeModule
until it seems Angular 17 when the error began to present itself. I triedMtxNativeDateTimeModule
and received the same error. I then usedNativeDatetimeModule
and this appeared to resolve the issue. I don't know what repercussions this may have in the project, but it does resolve the immediate issue.We define the following providers for reference.
As another reference, the other related modules being imported are: