Skip to content

Commit

Permalink
faker setting for localtime
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarHawk committed Jan 15, 2025
1 parent 27dd745 commit 311e8e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion generators/base-application/support/prepare-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ function generateFakeDataForField(
max: field.fieldValidateRulesMax ?? 32767,
min: field.fieldValidateRulesMin ?? 0,
});
} else if ([INSTANT, ZONED_DATE_TIME, LOCAL_DATE].includes(field.fieldType)) {
} else if ([INSTANT, ZONED_DATE_TIME, LOCAL_DATE, LOCAL_TIME].includes(field.fieldType)) {
// Iso: YYYY-MM-DDTHH:mm:ss.sssZ
const date = faker.date.recent({ days: 1, refDate: changelogDate });
originalData = date.toISOString();
if (field.fieldType === LOCAL_DATE) {
data = originalData.split('T')[0];
} else if (type === 'json-serializable') {
data = date;
} else if (field.fieldType === LOCAL_TIME) {
data = originalData.split('T')[1].split('.')[0];
} else {
// Write the date without milliseconds so Java can parse it
// See https://stackoverflow.com/a/34053802/150868
Expand Down

0 comments on commit 311e8e1

Please sign in to comment.