You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportinterfaceIEmployee{hireDate?: dayjs.Dayjs|null;}exportconstEmployeeUpdate=()=>{constemployeeEntity=useAppSelector<IEmployee>(state=>state.employee.entity);// If we write this expecting hireDate to be a dayjs type, we get an error at runtime. // This is because hireDate can be a **string** type.constyear=employeeEntity.hireDate?.year();
With the model as dayjs type, the results retrieved from the REST API must be converted.
Motivation for or Use Case
While this doesn't directly cause an error, it can lead to confusion during frontend development.
@qmonmert (cc @DanielFran) You're absolutely right, and I apologize for overlooking that.
I've also gone through this discussion. Given that we are using React + Redux-toolkit, it's recommended that our models are Serializable/Immutable. Unfortunately (as it is less usable than Angular or Vue), this means it would be better to revert to using the string type, specifically in the ISO 8601 format.
Additionally, if we decide to use the string type, we will need to change the role of src/main/webapp/app/shared/util/date-utils.ts.
// React components deal with local time, so it's necessary to convert them to UTC.exportconstconvertLocalToUTC=(date?: string): string|null=>(date ? dayjs(date).toISOString() : null);
This issue is stale because it has been open for too long without any activity.
Due to the moving nature of jhipster generated application, bugs can become invalid.
If this issue still applies please comment otherwise it will be closed in 7 days
Overview of the issue
Related to #23769 (comment)
With the model as
dayjs
type, the results retrieved from the REST API must be converted.Motivation for or Use Case
While this doesn't directly cause an error, it can lead to confusion during frontend development.
Reproduce the error
Related issues
#23769
Suggest a Fix
#23769 (comment)
JHipster Version(s)
https://github.com/jhipster/generator-jhipster/tree/3c5e8327f8909923a2411aeb20dcd0cbc1e96cfc
The text was updated successfully, but these errors were encountered: