Format utc time as hh:mm

I am capturing the current local time when a user marks a done using an AI component. All works fine with the exception of the way the date-timestamp is displayed. I am begging the ai component to display the timestamp in hh:mm, time_simple, and other ways to avoid the UTC format it is displaying now. Any ideas? The date field columns I’ve define is “time only”

1 Like

I think the AI component insists on having a direct connection between the values on the screen and what is stored. Convincing it otherwise is difficult. Your date is formatted as Time Only, but that’s just on the surface. A full ISO date is still what gets stored behind the scenes.

I’ve had full on cuss sessions with the AI because I want a text input to only save when I stop typing, but it insists of saving for each character. This has caused issues with the cursor bouncing or redisplaying characters when hitting backspace quickly. Usually you can get around that by asking for debounce logic which enforces a delay after typing before writing the value to the table and redisplaying it in the text box. But sometimes it fully disconnects from the table column… Takes a little bit of back and forth. (god I wish I could just jump into the code to fix some of these things instead of arguing with a robot) Little off topic, but trying to explain what’s happening behind the scenes in the code.

I’m guessing in your case time is displaying whatever is stored in the column no matter what. Even though you want it to display time only, it still pulls that underlying value. You could try instructing it to load the datetime into a variable, apply time formatting to the variable and only display the variable instead of the date that is stored. That might give it a bit of a disconnect. Any time the underlying date changes, the variable will be updated and it will apply it’s own formatting.

I tend to use JSON a lot when building custom components, whether the component builds the JSON object automatically and stores it, or I pass in my own JSON. Everything in a JSON object gets placed into variables in the code so it provides a bit of disconnect there. Seems to have worked well and makes it a lot easier to add or remove values from the JSON without having to add or remove parameters on the component itself.

2 Likes

Jeff - I COMPLETELY understand your frustration with arguing with a Robot. I would rather learn Scala than learn how to speak 3’rd grader robot-speak. grrrrrr.

I use Anthropic Claude for other dev and it does a decent job of explaining its rationale for what its doing. I see that feedback loop is disabled in Glide. Any ideas on why that is? the blackbox nature if the prompts is less than good imo.

I DID create the component with JSON originally and it got it off the ground. the prompt added the fields to the component automatically and I then got rid of the underlying JSON objects since they weren’t being used.

What I believe you are suggesting is to bring those back and rebuild the component so I don’t keep continuing to lose the wrestling match with the 3rd grader?

I am using a display if/then/else column to determine what time to show (default, or the timestamp when the user selects done). That being the case I will try creating another column to format the date as text and have the 3rd grader display that. cool?

2 Likes

A template column will definitely lock in the formatting as string text, so no underlying value, unlike an IF column. But what I was suggesting was for the ai to create an internal variable inside the component code rather than creating another table column.

2 Likes

i definitely prefer to use logic in the component rather than create a skyline of columns in the table. will pursue. thanks Jeff. you are so crazy responsive. dont know how you do it. much appreciated

you are SO THE MAN. Jeff (1) 3rd Grader (0)

2 Likes

Awesome! Glad it worked. Hey, some might say I’m smarter than a 5th grader. :wink:

1 Like

don’t get cocky! :laughing:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.