Button to Appear only if Date = Today

Hello, I want to enable a button ONLY if corresponding record timestamp is today’s date, my use case is an inspection-visit logging app, I need the supervisors to be able to log new photos related to such visit record as long as it happens in the same day.

I realize I need to somehow get Today’s date and then compare it with Timestamp, but dont know how to get Glide to output today’s date somewhere.

Thanks

Juan

You don’t need to get and store Todays date. Just put a visibility condition on the button that checks if the timestamp is within Today.

That’s amazing Jeff thanks a lot, BTW how can I extract from a date column just the date part? Gracias amigo!

A date/time column gives you 3 options for display:

Screen Shot 2021-11-12 at 6.42.06 AM

If you want more granularity, take a look at the Format Date plugin column.

Note that however you choose to display your date/time columns, Glide will still store them internally as a full date/time.

2 Likes

One thing that might not be an issue…. What is the time?

Glide calculates time based on the user device. Unless you do something different.

There is not yet any version of System Time.

For instance, I had my app open and close at a specific time. But every user around the world calculated that time specifically for themselves.

So today might not always be ‘today’ :slight_smile:

1 Like

This is a problem I faced many times as well. I always have to calculate the localized time if I expect there are users from different parts of the world, otherwise this logic will put me in trouble.

Now we have a plug-in to calculate it, it is necessary only to have the user geo into stored

You can derive it straight from their local time using the time format column and calculate things on their device, opposed to storing their geo info.

oh that’s good to know. Though usually expected unless specific function names that says otherwise. So Glide does not store a truncated version of your date/time, but only displays it as you set it. So the format is a display, not a truncate forever.
Should you need to get the whole d/t or even the seconds of it, you still can.

Yes, correct.
But the same behaviour can also trip you up if you start comparing dates and forget (or don’t realise) that each date also has a time component, that may or may not be visible.

3 Likes

oh yeah, it’s just a funny thing to see so many digits as decimals, that you have to catch like “tut tut tut com’ on children, behave, don’t show yourself unless asked”. I remember the 1st time we did a Date1 - Date2 with Notes Domino without knowing 1st it must by divided by (24 * 60 * 60) seconds, otherwise you get a paramount behemoth number… like you dated back pharaoh’s time…
That guilty developer’s fun :wink: