0

When use link inside of a form-list for delete a record, the fromDate which is a date-time field keeps a formatted value in hidden form as below. In the example of demo.moqui.org, it is a plain string like "1393454169956". The formatted one has problem since it is timezone related.

<input type="hidden" value="TEST1" name="exampleId">
<input type="hidden" value="2014-02-27 06:36:09.956" name="fromDate">
<input type="hidden" value="100001" name="exampleFeatureId">

So How to make it as plain string?

Jimmy Shen
  • 240
  • 1
  • 12
  • How is the form defined to produce this output? – David E. Jones Feb 26 '14 at 23:04
  • There should not be a time zone problem with a date/time string like that, whether hidden or user entered. It should be both formatted and parsed using the user's configured time zone, or the system default if no TZ is set for the user. – David E. Jones Feb 26 '14 at 23:05
  • It is coming from hidden linked from for delete button /example/Example/EditExampleFeatureAppls. Since fromDate is part of primary key, so the record can't be deleted. The underlying database is derby. demo.moqui.org is using MySql database, so I will try it in MySql database to see whether it is still same. – Jimmy Shen Feb 27 '14 at 01:45
  • After change to MySql database, it still same. and i found the delete does not work on http://demo.moqui.org/apps/example/Example/EditExampleFeatureAppls?exampleId=100100 now, the symptom is same with my local computer. it worked yesterday. – Jimmy Shen Feb 27 '14 at 02:21
  • It looks like this issue is specific to the parameter handling for the link element in a XML Screen or Form. I'll look into the output generation for that, basically it isn't taking into account the user's time zone for the date/time formatting, but it is for date/time parsing hence the mismatch. – David E. Jones Mar 01 '14 at 05:48
  • I've submitted an issue on github which has more detail comments there: https://github.com/jonesde/moqui/issues/16. – Jimmy Shen Mar 01 '14 at 10:39

2 Answers2

1

There is an improvement in Moqui Framework in commit #10d9e00: Changed URL parameters to use the same method as hidden form fields for the parameter value. For links rendered as hidden forms, which this question is based on, this will improve the behavior.

In general Moqui both formats and parses date/time values using the current user's time zone. If there are any exceptions to that found (like this one) it is a bug.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8
0

To make the date value like "1393454169956", it requires the the type of field to be "Timestamp" instead of "date-time". The from Date is "date-time", so if use the auto service of "update#ProductContent", it recognise the field of "fromDate" as "date-time" from the ProductContent entity definition. But if a service is defined as "delete#ProductContent" and it's fromDate parameter is type of "Timestamp", then the output value will be like "1393454169956".

And what's more, to use parameter which value in format of "Timestamp", it requires either pass it through a service which parameter is defined as "Timestamp" (service engine automatically translate it to date-time") or manually parse it with eci.l10n.parseTimestamp

Jimmy Shen
  • 240
  • 1
  • 12
  • What do you mean by Timestamp versus date-time, i.e. in which file, attribute/etc? These generally aren't interchangeable and are used in different places. – David E. Jones Mar 01 '14 at 11:01