Skip to content

Commit

Permalink
Merge pull request #24367 from qmonmert/fix/23769
Browse files Browse the repository at this point in the history
[React] Update model for date field in dayjs instead of string
  • Loading branch information
DanielFran authored Dec 1, 2023
2 parents 0b06b93 + e058fda commit 3c5e832
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
<%
const variablesWithTypes = this.generateEntityClientFields(primaryKey, fields, relationships, dto, 'string', embedded);
const variablesWithTypes = this.generateEntityClientFields(primaryKey, fields, relationships, dto, customDateType = 'dayjs.Dayjs', embedded);
const typeImports = this.generateEntityClientImports(relationships, dto);
const defaultVariablesValues = this.generateEntityClientFieldDefaultValues(fields.filter(field => !field.id));
const enumImports = this.generateEntityClientEnumImports(fields.filter(field => !field.id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ import { APP_LOCAL_DATETIME_FORMAT } from 'app/config/constants';
export const convertDateTimeFromServer = date =>
date ? dayjs(date).format(APP_LOCAL_DATETIME_FORMAT) : null;

export const convertDateTimeToServer = date => date ? dayjs(date).toDate() : null;
export const convertDateTimeToServer = (date?: string) : dayjs.Dayjs | null => (date ? dayjs(date) : null);

export const displayDefaultDateTime = () => dayjs().startOf('day').format(APP_LOCAL_DATETIME_FORMAT);

0 comments on commit 3c5e832

Please sign in to comment.