News:IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).

Hi everyone. I hope the title makes sense: I am trying to achieve a consistent definition of dates when there is some information missing (eg. the precise day or month of a given event).

Consider Tinderbox default behavior when you introduce something into $StartDate or $EndDate:

– if you put "2020", the output will be "15/06/20, 00:00"– if you put "10/2020", the output will be "01/10/20, 00:00"– if you put "05/10/2020", the output will be 05/10/20, 17:21"

I am trying to make this more consistent (IMHO) by using two user-defined list-type key attributes ($PartialStartDate and $PartialEndDate) which get interpreted by a set of rules and produce my desired $StartDate and #EndDate as follows:

– if I put year only in $PartialStartDate, $StartDate gets assigned the first day of that year, at 00:00;– if I put year only in $PartialEndtDate, $EndtDate gets assigned the last day of that year, at 23:59;

– if I put month and year only in $PartialStartDate, $StartDate gets assigned the first day of that month, at 00:00;– if I put month and year only in $PartialEndtDate, $EndtDate gets assigned the last day of that month, at 23:59;

– if I put month, year and day in $PartialStartDate, $StartDate gets assigned that day/month/year, at 00:00;– if I put month, year and day in $PartialEndtDate, $EndDate gets assigned that day/month/year, at 23:59;

(being list-type attributes, year, month and day are separated by ";" and not by "/")

Other rules state that:

– if the $PartialStartDate is empty, the $PartialEndDate is cleared as well (no end dates without start dates);

- $PartialEndDate gets assigned the content of $PartialStartDate, if empty; this allows, for example:

– you place 05/2020 in $PartialStartDate; – 05/2020 gets automatically assigned to $PartialEndDate; – $StartDate gets assigned "01/05/2020, 00:00" and $EndDate gets assigned "31/05/2020, 23:59"; – if needed, $PartialEndDate can be changed to other date, and $EndDate will be updated.

– if Tinderbox has a native way of doing this and I didn't knew;– if there's a more elegant way to write the set of rules;

– and a PROBLEM that I am having trouble sorting out: if I place "1949" in year, it gets interpreted as "2049"; but "1950" gets interpreted as "1950". I'd like years to be interpreted literally, with 4-digits ... trying but having no luck so far. So help appreciated to solve this one!

Side note: I see the conditional query code in your if(condition) statements uses legacy code to test 'is equal to'. As this syntax may stop working at some point, I'd suggest using the more recent form, i.e. '== 'test equality instead of '=' assignment.

Thanks again. At a given time I removed the date() because I was getting odd results, but the problem was with System Preferences / Short Date format, which was displaying years with 2 digits instead of 4. As a result, date() did a recalculation and the result was "wrong". But now I guess it's ok to get back at it