-
Notifications
You must be signed in to change notification settings - Fork 110
Description
Describe the bug
The CSV file with input data for calcs table has:
+------------+
| date0 |
+------------+
| 2004-04-15 |
| 1972-07-04 |
| 1975-11-12 |
| 2004-06-04 |
| 2004-06-19 |
| .... |
So I univocally identified format as yyyy-mm-dd, according to the last line. So, the third line has 12th Nov 1975.
There are test cases in tests exprtests\standard\setup.operator.date.*.txt:
date0 == #7/4/1972#
date0 >= #11/12/1975#
date0 > #11/12/1975#
date0 <= #11/12/1975#
date0 < #11/12/1975#
date0 - datetime0
datetime0 - #1/1/2004#
date0 - num4
date0 != #11/12/1975#
date0 + num4
The query generated for one of the tests is:
SELECT (`calcs`.`date0` >= DATE('1975-12-11')) AS `TEMP(Test)(1366787273)(0)` FROM `calcs` GROUP BY `TEMP(Test)(1366787273)(0)`
The day and the month were swapped, so the test failed.
Once I change OS settings as shown on the screenshots

Query changes and test passes
SELECT (`calcs`.`date0` >= DATE('1975-11-12')) AS `TEMP(Test)(1366787273)(0)` FROM `calcs` GROUP BY `TEMP(Test)(1366787273)(0)`
So, the outcome is: test result depends on the date format settings where test is being executed. That's incorrect.
As a fix I suppose that all tests should store input dates (times and datetimes) in the save format as CSV has. Otherwise the format should be hardcoded to match the CSV or, better, defined somehow in test specs, for example:
date0 == #7/4/1972# // dd/mm/yyyy
date0 >= #11/12/1975# // dd/mm/yyyy
...
I found 39 test cases (~5%) in TDVT v.2.4.0 affected by this.
Desktop (please complete the following information):
- OS: Win 10
- Tableau Version: 2021.3
About you:
Name: Yury Fridlyand
Company: Bit Quill