04-27-2020, 02:10 PM
(This post was last modified: 04-27-2020, 02:12 PM by remkonoteboom.)
It should have been possible to just subtract the dates:
@GET(.bid_end_date) - @GET(.bid_start_date)
However, I found that there is a bug in the code, in src/pyasm/biz/expression.py
1050 # convert result to seconds if it is a timedelta
1051 if isinstance(result, datetime.timedelta):
1052 result = results.seconds
This doesn't take days into account and should maybe have been:
1052 result = result.days*24*3600 + result.seconds
However, looking at it now, I think it should return a timedelta and that this conversion to seconds is incorrect. This was probably done a while ago when datetime and timedelta were not so well supported in Python2 (yes, there was a time when lots of things didn't handle dates very well).
I think the best solution would be to comment out 1051 and 1052 completely. I am not sure what code would break if that's the case.
Note: this does not do the same as @NETWORKDAYS which calculate business days. All the date tools for calculating this are in TACTIC code but have not been mapped to the expression language.
@GET(.bid_end_date) - @GET(.bid_start_date)
However, I found that there is a bug in the code, in src/pyasm/biz/expression.py
1050 # convert result to seconds if it is a timedelta
1051 if isinstance(result, datetime.timedelta):
1052 result = results.seconds
This doesn't take days into account and should maybe have been:
1052 result = result.days*24*3600 + result.seconds
However, looking at it now, I think it should return a timedelta and that this conversion to seconds is incorrect. This was probably done a while ago when datetime and timedelta were not so well supported in Python2 (yes, there was a time when lots of things didn't handle dates very well).
I think the best solution would be to comment out 1051 and 1052 completely. I am not sure what code would break if that's the case.
Note: this does not do the same as @NETWORKDAYS which calculate business days. All the date tools for calculating this are in TACTIC code but have not been mapped to the expression language.