ACI0097752: Object notation: Time is not automatically converted to ISO date; it must be explicitly converted (which makes little sense)
In code, when a time value is assigned to an object, the value is stored milliseconds.
I supposed the idea is that:
Time is not a native JSON data type.
Number is a native JSON data type.
Time is counted in seconds in 4D, milliseconds in JS.
The conversion is bidirectional in 4D code:
4D Time to Object Numeric…multiply by 1000
Object Numeric to 4D Time…divide by 1000
However, with the introduction of object notation, it makes more sense to use the time portion of an ISO date instead of a number. The advantage of an ISO date is that it can be implicitly converted to Time. With object notation, there is no option to specify the data type as in OB Get; the only hint is the type of the left operand.
Example code in current implementation:
$o:=New object(“birthday”;Current date;“create_time”;String(Current time;ISO date))
So it becomes mandatory to use explicit casts, i.e. String(), Time(), Date() in each instance, even though the data type of the left operand is declared in code.
It would be better if 4D did the conversion to and from Time implicitly.
Example code in proposed implementation:
$o:=New object(“birthday”;Current date;“create_time”;Current time)