Chromebooks -> Calendar Events Not Showing

That is how the problem was solved. With your suggestion, I logged in to a kid’s computer, but I could still see everything with my login. That meant it wasn’t the Chromebook. It was the kids’ accounts that contained the issue. There was something going on with the javascript too. The tech guys at the county level unblocked a site that was used by the app to show that data.

All is right in my universe. Happy Thanksgiving!

2 Likes

I just saw this. This is a neat formula. So elegant.

Just so I understand:

  1. “date” inside a Date-Time column: a date, perhaps in ISO format
  2. ”ABS(date)” inside a math column: the same date, represented as a number in days (with its whole number and decimal parts), with the origin of the scale starting on Dec. 3, 1899.
  3. ”TRUNC(date)” inside a math column: the whole number part of the date
  4. ”ABS - TRUNC”: the decimal part of the date (including minutes, seconds, milliseconds, microseconds, nanoseconds, … ad infinitum) This is beautiful. I so much prefer this compared to removing minutes and seconds and so on.
  5. date - (ABS - TRUNC): the equivalent of TRUNC (the whole part of the date) represented as the date again (I suppose in ISO format). Since the standard is that days start at 0:00, then date - (ABS - TRUNC) would be the date-time at 0:00. So simple yet so powerful.

So now my question which you see coming I’m sure: why do we need to add 10^(-10) (or as you wrote it 0.0000000001)? I know you said that it seemed that at times the formula was glitching to just before midnight, but maybe you were using “now” or “today” in your test? If the date is static, I don’t understand how mathematically the output could land before midnight. Also, why 10^(-10) and not 10^(-100)? Because of what Glide can read, or standards in programming?

I do feel that the formula that belongs in the guide is “date - (ABS - TRUNC)” in its purest form. But if it’s pure and doesn’t work 100% of the time, then that wouldn’t be good either. Adding 10^(-10) feels so arbitrary. What do you think?

I really like the elegance of this formula. Handing you back you beer, Jeff :beer_mug:

@Jeff_Hager@Darren_Murphy

1 Like

I have two guesses as to what’s happening. One is that when using Now for the date, it is evaluated each time it’s used in the formula. In this case it’s possibly evaluated 3 separate times instead of once and each evaluation is fractions of a millisecond different from the others (makes me wonder if writing the formula backwards would make a difference :thinking:). The other thought is that maybe we are getting a floating point decimal in the math. In either case it seems to occasionally subtract a little to much and the math ends up slipping just before midnight, which is the previous day. I haven’t verified what is actually happening, so it’s only a theory.

In either case, my solution was to subtract 0.0000000001 to put the result back to midnight or a fraction of a millisecond past it. It’s weird, but without it the date would float back and forth between the current day and the previous day. I feel like static dates might be more reliable than a dynamic date such as ‘Now’. But it’s hard to verify if that’s true.

My solution is not bulletproof as you pointed out, but it felt mostly stable when I tested it. I do wonder if it would cause any issues when used for relations or something like that if there is still a few milliseconds difference.

The whole problem stems from the fact that Glide math seems to either be overly cautious on the warnings or it’s missing a fundamental date math function that we need. The most frustrating part is that you can subtract two dates to get a decimal; you can add or subtract a decimal from a date and still get a date; but you can’t convert a decimal to a date and can’t convert a date to a decimal without jumping through hoops. That’s where I discovered that ABS was a possible workaround to convert a date into a decimal. It seemed to be the only math function that will directly convert a date to a decimal without extra math logic. With ABS returning a decimal, I can subtract the whole number (Trunc) from the ABS decimal number to get only the remainder after the decimal point. Finally I can subtract only that decimal from the original date to remove time. If Glide would simply provide a function to trunc a date to remove time and still return a date data type, then this would be super easy. Javascript could be an alternative but Glide is stuck on only passing character (text) data types back.

Math and Javascript columns are very well overdue for an overhaul along with several other fundamental basic functions, all of which haven’t had development since initial release. While it’s not ideal, a lot of the date math we use is excessively complex, especially when there are native code functions that exist and handle these types of situations much more eloquently.

If you do add this formula to your date thread, maybe add a disclaimer that it’s experimental and not guaranteed to be accurate. It would take more testing and debugging to see if there was a way to make the formula more bulletproof.

2 Likes

Will do. I love your approach with ABS and TRUNC. I feel like updating all the others where appropriate.

What would one need to do to test: stare at the output for a significant amount of time (1 hour) to see if the output slips to before midnight? (in the case of a static date)

This is a fun thought. Your thinking is so pragmatic.

Thanks for sharing your thoughts, I’ll update our guide.