Searching on DATETIME fields

This has probably been asked before, but I thought some clarification might be needed for others who will hit these issues.

I feel the following code should obey the order following it. Servoy should make assumptions about a method that attempts an automated find.

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

  1. 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 Finding/searching on dates - Classic Servoy - Servoy Community 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…

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();

in javascript you don’t work with fields but only with dataproviders.. So we can’t say

forms.mag_subs.subs_renewdate

should work with the fieldY’s format…

Because we don’t know that the dataprovider is shown for that field in javascript.. Those 2 are completely seperated…

what should we do for example if there are 2 or 3 fields with different formats for that dataprovider??

For this we need something like a format bound to a dataprovider.. (and then fields are using that by default)