Jhipster jdl adding fake data LocalDate field is null in the database, 日期格式问题
Jhipster jdl adding fake data LocalDate field is null in the database, Date format issue
我用
生成了一个实体
jhipster import-jdl hello.jdl
entity Hello {
title String,
myDate LocalDate
}
生成默认假数据
hello.csv
id;title;myDate
1;mobile Fish;2019-11-17
2;Savings Account Dam;2019-11-18
问题
但是我的日期格式是爱沙尼亚语 DD.MM.YYYY,因此如果我将其更改为以下格式,则数据不会导入到数据库中。两个条目的 myDate 字段都为空。有什么方法可以导入除 YYYY-MM-DD 之外的其他格式的日期吗?
hello.csv
id;title;myDate
1;mobile Fish;17.11.2019
2;Savings Account Dam;18.11.2019
很遗憾,您无法更改此格式,因为 Liquibase 要求日期采用 "yyyy-MM-dd" 格式,如 its doc:
中所述
Date/Time values included in the CSV file should be in ISO format http://en.wikipedia.org/wiki/ISO_8601 in order to be parsed correctly by Liquibase.
它在 liquibase.util.ISODateFormat.java 中被硬编码,因此 JHipster 对此无能为力。
我用
生成了一个实体jhipster import-jdl hello.jdl
entity Hello {
title String,
myDate LocalDate
}
生成默认假数据
hello.csv
id;title;myDate
1;mobile Fish;2019-11-17
2;Savings Account Dam;2019-11-18
问题
但是我的日期格式是爱沙尼亚语 DD.MM.YYYY,因此如果我将其更改为以下格式,则数据不会导入到数据库中。两个条目的 myDate 字段都为空。有什么方法可以导入除 YYYY-MM-DD 之外的其他格式的日期吗?
hello.csv
id;title;myDate
1;mobile Fish;17.11.2019
2;Savings Account Dam;18.11.2019
很遗憾,您无法更改此格式,因为 Liquibase 要求日期采用 "yyyy-MM-dd" 格式,如 its doc:
中所述Date/Time values included in the CSV file should be in ISO format http://en.wikipedia.org/wiki/ISO_8601 in order to be parsed correctly by Liquibase.
它在 liquibase.util.ISODateFormat.java 中被硬编码,因此 JHipster 对此无能为力。