I feel the following code should obey the order following it. Servoy should make assumptions about a method that attempts an automated find.
- Code: Select all
currentcontroller.find();
var today = new Date();
var searchDate = utils.dateFormat(today, 'MM-dd-yyyy')
forms.mag_subs.subs_renewdate = searchDate;
currentcontroller.search();
1. If the field being searched on the form has a format assigned to it, and is a displayType CALENDAR, (such as MM/dd/yyyy) then the field should require/obey that format.
2. If the field being searched on the form has no format assigned then it should default to the setting in Preferences > Locale
> Date Format
3. We should be able to use a function like getLocaleDateFormat() found under the Application object so we can coerce dates in functions like utils.dateFormat() -This addition would anticipate localization issues that should be added for international versions of Servoy front ends. Using a table to determine time zone offsets and comparing against a local clock should allow the adjustment of date formatting.
P.S. Yes, I found this post http://forum.servoy.com/viewtopic.php?t=776 but I think formatting on date fields should have overrides for searching. I do know that the code above has to be formatted as such in order to work...
- Code: Select all
currentcontroller.find();
var today = new Date();
var searchDate = utils.dateFormat(today, 'MM-dd-yyyy')
forms.mag_subs.subs_renewdate = searchDate + '|MM-dd-yyyy';
currentcontroller.search();