Based on this.
Indeed an overkill but I can’t help it that Glide is not giving us any flexibility with the date formats. It’s US format, period.
Based on this.
Indeed an overkill but I can’t help it that Glide is not giving us any flexibility with the date formats. It’s US format, period.
I’d be willing to bet that’s your problem. The date plugins are buggy, period.
Get rid of that, and just configure your datetime column in Glide as Date only, medium.
Or use the math approach that Jeff suggested.
Yes, exactly what I did and…viola…it’s working.
Dates are fun, aren’t they?
Don’t get me started on dates…
Yeah, I saw your other posts on dates and thought it would be fun to see your vent again
It’s good to let it out
As part of my day job, I often have to massage data from external sources - quite often Excel - that comes to me in all sorts of weird and wonderful formats.
I have whole library of GS functions for dealing with this rubbish, that I’ve built up over time.
Here’s one that makes me vomit a little bit inside my mouth every time I look at it…
function check_valid_date(date, expected_month) {
var expected_month_index = LONG_MONTH_NAMES.indexOf(expected_month);
var data_type = typeof date;
switch (data_type) {
case "object": // It's probably a date
var checkdate = new Date(date);
if (checkdate.getMonth() === expected_month_index) {
// It's a valid date for the correct month, yay!
return checkdate;
}
break;
case "string": // Is it a string pretending to be a date?
date = date.trim();
var checkdate = new Date(date);
if (checkdate.getMonth() === expected_month_index) {
// It's a valid date for the correct month, yay!
return checkdate;
}
else {
// Check the delimiters, then swap the day/month bits
var delimiter = date.includes('/') ? '/' : '-';
var parts = date.split(delimiter);
checkdate = new Date(Number(parts[2]), Number(parts[1]) - 1, Number(parts[0]));
if (checkdate.getMonth() === expected_month_index) {
// It's a valid date for the correct month, yay!
return checkdate;
}
}
break;
default:
// God knows what it is, pig-latin?
return undefined;
}
}
Yes, dates are indeed fun.
funny, but TMI
Your fault, for letting the genie out of the bottle
A while ago I posted about these issues. I actually resorted to writing apps script to format the dates automatically for me:
(the below links to my earlier post, with annotated apps script)
@Darren_Murphy , date formats are such a pain. And if I may add, so are inches, feet, yards, miles, pounds, stones, and driving on the wrong side of the road (Edit: and gallons, quarts, cups of flour, table spoons, teaspoons)
I don’t know if this can help, but as @Jeff_Hager did by converting a date to an integer, I did the same recently by using a plugin column: Date & Time / Date format. The Luxon token I used was “X”. I believe I used this for sorting, because if I recall correctly, in the builder the sorting feature sorts dates as if they were strings and not dates (which makes no sense ).
Luxon table of tokens you can use with the date format plugin
If only they had a token to change the date format to EU or ISO. Maybe I missed it
Luxon is quite buggy for me when working with countries that uses dd/mm/yyyy, so please beware if you want to deploy to users in countries that use different time formats.
I have kind of given up on displaying the dd/mm/yyyy format. I used Luxon only because my dates didn’t seem to sort well, converting them to an integer seemed to work. You’re making me doubt now, I’ll have a look
Make sure you test on Safari, because I had big problems with Luxon in Safari.
Yes, I’m aware of this plugin. And I was using it for a while. But then I discovered that it is broken, and so I stopped using it. Every now and then I give it a try, observe that it’s still broken, and continue to not use it. If/when it becomes unbroken, I’ll definitely start using it (and the other date plugins) again
(the way I understand it, it’s not the plugin itself that’s broken, but the underlying Luxon library - as Thinh pointed out. Either way, it can’t be relied upon)
Thanks for the feedback you two (Darren and Thinh), I had no idea it was broken. I used that integer, it helped sort correctly, so I assumed the library/plugin worked fine.
This table should be in the Glide documentation! Thank you for posting it. I had to search for an hour to figure out how to use this JS Token until I found your link!
You saved the day…
I’m not sure, but I don’t think the table could be included in the documentation because the table is subject to change by a 3rd party.
Also beware, according to @ThinhDinh and @Darren_Murphy the table – and therefore the plugin – might be buggy.
Oh, OK, I see. Even people no using Glide say it’s buggy under IOS with Safari. Thanks, I will stay away from it. What options do I have in Glide to format dates besides JS? I don’t know JS…
If you search for “date format” in the forum you’ll find quite a few discussions on the topic. Most ways to display the date in a non-US way is usually a workaround or hack, which I personally avoid.
Date formatting options currently available
(limited to a US date really)
In the data editor, in a date basic column, when you click on edit, at the bottom of the menu you’ll see display options:
Ideally, we’d have additional options:
Thanks, I agree!