mysql - jhipster and ZonedDateTime -
when persist zoneddatetime, zone information discharged.
zoneddatetime = zoneddatetime.now(zoneid.of("america/santo_domingo")); zoneddatetime firstmomentinmonth = now.withdayofmonth(1).truncatedto(chronounit.days); zoneddatetime lastmomentinmonth = now.withdayofmonth(now.tolocaldate().lengthofmonth()).truncatedto(chronounit.days).with(localtime.of(23, 59, 59, 999999999)); log.debug("firstmomentinmonth = {}", firstmomentinmonth); log.debug("lastmomentinmonth = {}", lastmomentinmonth); ledger = new ledger(); ledger.setstartdate(firstmomentinmonth); ledger.setenddate(lastmomentinmonth); return ledgerrepository.save(ledger);
the output log:
firstmomentinmonth = 2017-09-01t00:00-04:00[america/santo_domingo] lastmomentinmonth = 2017-09-30t23:59:59.999999999-04:00[america/santo_domingo]
and in mysql workbemnch :
'6', '2017-09-01 00:00:00', '2017-09-30 23:59:59', 'open', null, '1', '3'
, in workbench can see zone information discharged. found out when app went production on heroku, server in timezone users. finders come wrong results.
here ledger.json:
"fields": [ { "fieldname": "startdate", "fieldtype": "zoneddatetime" }, { "fieldname": "enddate", "fieldtype": "zoneddatetime" },
am doing wrong ?
Comments
Post a Comment