| Ticket UUID: | 73384a82adedf4a7986301cfad8ae27017f68ec0 | ||
| Title: | clock scan calendaric calculation error | ||
| Type: | Bug | Created on: | 2018-04-16 15:57:59 |
| Submitter: | anonymous | Assigned to: | kbk |
| Subsystem: | 16. Commands A-H | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2018-04-16 16:40:44 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 8.4.12, 8.4.20 , 8.6.5 | ||
| Description: | ||||
foreach part {yesterday today now tomorrow} {
puts stdout "[clock format [clock scan "${part} 3 months ago" ] -format {%Y.%m.%d}] : ${part} 3 months ago"
}
2018.01.17 : yesterday 3 months ago !!! FALSE that's tommorrow 3 months ago
2018.01.16 : today 3 months ago
2018.01.16 : now 3 months ago
2018.01.15 : tomorrow 3 months ago !!! FALSE that's yesterday 3 months ago
Could it be yesterday and tomorrow are mixed in calendar calculations?
Unsing '-3 months' instead of '3 months ago' gives correct results!
foreach part {yesterday today now tomorrow} {
puts stdout "[clock format [clock scan "${part} -3 months"] -format {%Y.%m.%d}] : ${part} -3 months"
}
2018.01.15 : yesterday -3 months
2018.01.16 : today 3 months
2018.01.16 : now 3 months
2018.01.17 : tomorrow -3 months
| ||||
| User Comments: | ||||
sebres added on 2018-04-16 16:40:44:
The problem is - both "yesterday/tomorrow" as well as "3 months" are currently relative units (effectively days). So the suffix "ago" works like simply "negation" for both units equally. So unfortunately ATM it is even equally to: "tomorrow 3 months ago" === "1 day 1 month ago" "yesterday 3 months ago" === "-1 day 1 month ago" Sounds a bit strange, but simply said: don't use "ago" suffix if you've multiple relative units (as mix) in the free-scan string. @Kevin, @TCT Theoretically I could relative easy change the logic of "tomorrow/yesterday" (should not be tDAY_UNIT (yyRelDay) anymore, so can affect the base instead of relunit), but such change is not backwards-compatible at all. What would you say about? | ||||
