Zen - Problem with dateText component (format and separator attributes)
When working with the dateText component in a Zen Application and setting the parameters "format:DMY" and "separtator:/" I cannot save the right date to the database.
In short, I have a structure similar to :
Class View.A Extends%ZEN.Component.page { XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ] { ... <dataController id="a-controller" modelClass="MVC.A"/> <dynaForm id="a-form" controllerId="a-controller" onsubmit="return zenPage.saveForm();"/> } }
Class MVC.A Extends %ZEN.DataModel.ObjectDataModel { Property DOB As %Date (ZENATTRS = "id:DOB|format:DMY|separator:/, ZENCONTROL = "dateText") ; ... other methods Method %OnStoreModel(pSource As Modelo.Pedido) As %Status { Set pSource.DOB = ..DOB Quit $$$OK } }
Class Model.A Extends %Persistent { Property DOB As %Date; }
When I don't use the attributes "format" and "separator", then it's saved normally. However, with them , the date saved is "1840-12-31".
I've seen the below post about a similar subject, but it was a long time ago. Is it possible that the bug still exists in version "2015.2.1.705.1" (mine)?
https://groups.google.com/forum/#!topic/intersystems-zen/VLCqAlXumjI
I wonder if someone could point the solution to me.
The date is saved to the database correctly.
Thank you for the rapid response Vitaliy Serdtsev .
I'm new to Caché and I was probably doing something wrong when manipulating the data in the %OnStoreModel method. I've started it fresh again and now it's working as expected.