Dates vs luxon dates

Okay so i use a lot of date formatting luxon in my apps. Lately I’ve read that issues can happen, and i really want to try sticking to Glides date column only.

However, Glide only has a date time column. Even when I select date only, while I’m using a choice component to allow users to select the date they want to see. The correct date is selected but the choice component only shows that date for a few seconds. Probably because the time time changes and the 2 dates no longer match.

Am i forced to use Luxon formatting in such a case?

I see 2 méthods, and really only 1 that should be 100% reliable.

Turn your DateTime values into integers
@Darren_Murphy speaks about this often in the forum. It seems to be the most reliable method to work with dates and eliminate the time and therefore decimal portion of DateTime.

Use a math column: YEAR(DateTime)*10000 + MONTH(DateTime)*100 + DAY(DateTime) will give you a YYYYMMDD integer of DateTime.

Anchor the time portion of DateTime to midnight 00:00:00 (any other time would do, as long as it’s anchored and all DateTimes used the same anchor)

@Jeff_Hager discusses using a seed date to eliminate the time portion of DateTime. It might work for you. I don’t think this approach is as brute force as the integer approach.

3 Likes

I use this method so often I have a keyboard shortcut for it :sweat_smile:

5 Likes

I’m aware of that, but how does that help me put a Date value into a choice component that a user can select to update the date of his search.

The choice component needs to hold values easily readable like Feb 12, Feb 13, Feb 14.
Currently if a user selects Feb 12, the date is chosen but the choice component doesn’t hold the value because what they have is a different Feb 12 with a different time.

The choice component accepts two values - one for display, and another that’s written to the target column.

So present a human readable date as the displayed value, and write the normalised date to the target column.

3 Likes