I have noticed this strange behavior.
What I am trying to do:
If DateFrom and DateTo is the same date show only one date if they are different show two dates with – in between them.
My setup:
Formula of 1.:
If( DateDiff(ThisItem.DateFrom,ThisItem.DateTo,Days) = 0, ThisItem.DateFrom, ThisItem.DateFrom&" - "&ThisItem.DateTo )
To test I put some extra fields
Formulas
2.
DateDiff(ThisItem.DateFrom,ThisItem.DateTo,Days)
3.
"DateFrom: "&ThisItem.DateFrom
4.
"DateTo: "&ThisItem.DateTo
5.
ThisItem.DateFrom&" - "&ThisItem.DateTo
Database structure (showing only fields in question):
CREATE TABLE VacationRequest ( DateFrom date NOT NULL, DateTo date NOT NULL, );
This is clearly a bug or am I missing something? I can reproduce this 100% of the time.
- Have a database with two date fields
- Create a gallery
- In text field write the following formula:
If( DateDiff(ThisItem.Date1,ThisItem.Date2,Days) = 0, ThisItem.Date1, ThisItem.Date1&" - "&ThisItem.Date2 )
I have also tested this with different table where dates were datetime variable and got same results.
Crazily enough if you play with formula and reverse it, it works:
If( DateDiff(ThisItem.DateFrom,ThisItem.DateTo,Days) <> 0, ThisItem.DateFrom&" - "&ThisItem.DateTo, ThisItem.DateFrom )
Or if you add an empty string:
If( DateDiff(ThisItem.DateFrom,ThisItem.DateTo,Days) = 0, ThisItem.DateFrom&"", ThisItem.DateFrom&" - "&ThisItem.DateTo )

Report
All responses (
Answers (