v11.1p_2020-07-15/Pro Deployment (built 2020-07-15)
I am having a problem rendering an absolute date value in a FilterBuilder RelativeDateItem that has a custom date format applied. My preferred date format is yyyyMMdd consistently across both client and server. I am able to get the client to display and transmit this format to the server, but when it comes back from the server (e.g. load a saved filter) the value is in the RPC response, but does not render in the client. The field appears empty.
I've tried setFormat("yyyyMMdd"), setInputFormat("yyyyMMdd") and various combinations of DateUtil.setDateInputFormat("YMD") and DateUtil.setShortDateDisplayFormatter(...) with no success.
The following code snippet is the closest I've come to making an absolute date value render consistently in the client when sent from the server, but it uses in-built formatters which are no good in my situation.
This formats the date in the client as yyyy/MM/dd and transmits the date value to server as yyyy-MM-dd. When loaded from the server, the value is yyyy-MM-dd format and is rendered in the client as yyyy/MM/dd. I presume the conversion to yyyy-MM-dd is significant here...?
If I change the code to set the custom format it doesn't work.
I presume this is because the client cannot understand my format and render it as a date? But what am I missing?
I am having a problem rendering an absolute date value in a FilterBuilder RelativeDateItem that has a custom date format applied. My preferred date format is yyyyMMdd consistently across both client and server. I am able to get the client to display and transmit this format to the server, but when it comes back from the server (e.g. load a saved filter) the value is in the RPC response, but does not render in the client. The field appears empty.
I've tried setFormat("yyyyMMdd"), setInputFormat("yyyyMMdd") and various combinations of DateUtil.setDateInputFormat("YMD") and DateUtil.setShortDateDisplayFormatter(...) with no success.
The following code snippet is the closest I've come to making an absolute date value render consistently in the client when sent from the server, but it uses in-built formatters which are no good in my situation.
Code:
// Code that displays a date from server using TOJAPANSHORTDATE final RelativeDateItem defaults = new RelativeDateItem(); defaults.setAllowAbsoluteDates(true); defaults.setDateFormatter(DateDisplayFormat.TOJAPANSHORTDATE); RelativeDateItem.setDefaultProperties(defaults);
Code:
filterJson:"{\n \"_constructor\":\"AdvancedCriteria\", \n \"operator\":\"and\", \n \"criteria\":[\n {\n \"fieldName\":\"My_Field\", \n \"operator\":\"equals\", \n \"value\":\"2021-08-31\"\n }\n ]\n}" },
If I change the code to set the custom format it doesn't work.
Code:
final RelativeDateItem defaults = new RelativeDateItem(); defaults.setAllowAbsoluteDates(true); defaults.setFormat("yyyyMMdd"); RelativeDateItem.setDefaultProperties(defaults);
Code:
filterJson:"{\n \"_constructor\":\"AdvancedCriteria\", \n \"operator\":\"and\", \n \"criteria\":[\n {\n \"fieldName\":\"My_Field\", \n \"operator\":\"equals\", \n \"value\":\"20210831\"\n }\n ]\n}" },
Comment