# Agent for information

**URL:** <https://community.glideapps.com/t/agent-for-information/29981>\
**Category:** Ask for Help\
**Tags:** custom-code\
**Created:** [August 4, 2021, 11:33am UTC](https://community.glideapps.com/t/agent-for-information/29981 "2021-08-04T11:33:43Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/96552_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 1, 2021, 4:55am UTC](https://community.glideapps.com/t/agent-for-information/29981/62 "2021-09-01T04:55:40Z")

</div>

Have you tried just passing the Glide date column to your YC function as a string, and then using `new Date()` to convert it to a JS Date object?

This is what I have been doing, and it seems to work fine, regardless of the date format. (Admittedly, I haven’t tested it with every possible format).

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 1, 2021, 5:21am UTC](https://community.glideapps.com/t/agent-for-information/29981/63 "2021-09-01T05:21:32Z")

</div>

Hello @Darren_Murphy  
Yes, anyway a YC column with a ‘date-time’ type necessarily arrives in string format (see the readme) so you have to do a ‘new date’. the problem is not the format (short, medium, long) but depending on the regions mm / dd / yyyy or dd / mm / yyyy or other

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 1, 2021, 3:07pm UTC](https://community.glideapps.com/t/agent-for-information/29981/64 "2021-09-01T15:07:44Z")

</div>

The problem here Darren is how Glide reads/handles the date, how the user sees it and how JS works with it.

If I’m in Latin America, my date format is **dd/mm/yyyy** and if this code is executed I will receive an error in my YC column although Glide shows it perfectly.

Example 1

```auto
t = '22/3/2021' ; // March 22, 2021
return new Date(t) // Returns “Invalid Date”

```

Example 2

```auto
t = '12/3/2021' ; // March 12, 2021
return new Date(t) // Returns “Fri Dec 3 2021” - wrong date!

```

JS does not have a Date type as variable unfortunately, any Date value is treated as string 🤒

Saludos!

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 1, 2021, 3:36pm UTC](https://community.glideapps.com/t/agent-for-information/29981/65 "2021-09-01T15:36:37Z")

</div>

Hi friends,  
there is an open discussion for the problem of dates, it is good if we continue on the right subject.

> [@Date Hell](https://community.glideapps.com/t/date-hell/31031):
>
> Hello @Mark Is it possible when using the “date-time” type that glide does a conversion from the regional format to the “us” format automatically (or at the limit to the ISO format, because I think that is to accept by new Date(…)). Because my browser is in French, so the format is in dd / mm / yyyy except that if I send a Date column directly to YC (for example 15/8/2021) and I do a Let x = new Date (date.value) I get an invalid date error, logical since js is in “us” format. And if possibl…

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/96552_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 1, 2021, 5:24pm UTC](https://community.glideapps.com/t/agent-for-information/29981/66 "2021-09-01T17:24:18Z")

</div>

> [@gvalero](#):
>
> The problem here Darren is how Glide reads/handles the date, how the user sees it and how JS works with it.

Just to humour me, can you please try this and let me know the result?

- Set your Glide date column to “medium” format, so it displays like “September 1, 2021, 1:18 AM”
- Create a template column to lock in that format
- Pass the template column to a YC column that tries to turn it into a date object using `new Date()`

That works fine for me, but maybe as you say there might be regional variations that break it. I’m curious to know.

PS. In my region, it’s also customary to use dd/mm/yyyy, but personally I would _never_ use that format - or it’s ugly cousin mm/dd/yyyy. 😉

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 1, 2021, 6:27pm UTC](https://community.glideapps.com/t/agent-for-information/29981/67 "2021-09-01T18:27:00Z")

</div>

@Darren_Murphy

here you have:

1- Using **en-US** format (mm/dd/yyyy). I set my web browser to English and everything is ok:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/d/add9b979ddd939c6d6ba8e11e37d01a2c05c5fa0.png)

2- Using **sp-419** (format dd/mm/yyyy). I set my web browser to Spanish and problems appear:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/f/3fa47d78a9fa985c4f3baae8bb59aece3aaa2b37.png)

Let me finish my code to find/handle several formats and I will share it to test it.

Feliz día!

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 1, 2021, 6:40pm UTC](https://community.glideapps.com/t/agent-for-information/29981/68 "2021-09-01T18:40:30Z")

</div>

in fact, nobody tested my code 😜 😂 🤣, because I solved the problem of the format according to the country dd/mm/yyyy mm/dd/yyyy, … and the format short, medium, long 😜 😜

> [@Date Hell](https://community.glideapps.com/t/date-hell/31031/6):
>
> I share with you the code I made to test the Glide \<-\> JS conversion. There are 2 two scripts: for a Date column for an Array Split (depends on the 1st script) The idea is to come and go and confirm the conversion. Script 1, Date Column Test YC [https://Date-Test.manun2.repl.co](https://Date-Test.manun2.repl.co) Source [https://replit.com/@ManuN2/Date-Test?v=1](https://replit.com/@ManuN2/Date-Test?v=1) Script 2, Array Test YC [https://Date-Test-Array.manun2.repl.co](https://Date-Test-Array.manun2.repl.co) Source : [https://replit.com/@ManuN2/Date-Test-Array?v=1](https://replit.com/@ManuN2/Date-Test-Array?v=1) Please give me a feedb…

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 1, 2021, 8:35pm UTC](https://community.glideapps.com/t/agent-for-information/29981/69 "2021-09-01T20:35:38Z")

</div>

Ufff … I didn’t know that 🤣

Let me come back to my home and I will test your YC

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/96552_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 2, 2021, 3:38am UTC](https://community.glideapps.com/t/agent-for-information/29981/70 "2021-09-02T03:38:36Z")

</div>

ah, now I see. The problem is that `new Date()` can only parse a human readable date if it’s in in English, yes? Maybe you need to pre-process your dates by first passing them through a YC translate column - just kidding 🤣 🤣

If only everyone could agree that the only truly sensible date format is yyyy-mm-dd, then all these problems would evaporate.

Dates are such a PITA 🤢

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 2, 2021, 4:23am UTC](https://community.glideapps.com/t/agent-for-information/29981/71 "2021-09-02T04:23:01Z")

</div>

> [@Darren\_Murphy](#):
>
> If only everyone could agree that the only truly sensible date format is yyyy-mm-dd, then all these problems would evaporate.

We would need to start a campaign for this, get 100 million signatures maybe 🤣

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 2, 2021, 8:18pm UTC](https://community.glideapps.com/t/agent-for-information/29981/72 "2021-09-02T20:18:34Z")

</div>

hola @Manu.n

here my tests using your code, there is no good news, don’t hate me 😇

I’m using dd/mm/yyyy format (Spanish):

With **short** , it works fine:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/7/979dafd1a6d1fb150189353e04d6976ab6123ee2.png)

With **medium** or **long** , an error appears 🤨

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/f/df2f149f1228715003732d8e8dfe1808411a2e90.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/9/5918b7139201ec571b906385a9437f3bfbffce8b.png)

Am I doing anything wrong or JS is doing its job unfortunately?

Saludos!

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 2, 2021, 8:27pm UTC](https://community.glideapps.com/t/agent-for-information/29981/73 "2021-09-02T20:27:53Z")

</div>

Manu,

here using **mm/dd/yyyy** and English as language: 👍

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/03715b3f79bbd5c125eaa982386e25d6db3b2267.png)

but with **medium** or **long** , an error appears again 😰

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/9/f9a171459d9bf86020e3bd3a4b0a0a3dae3a0f6f.png)

I’m using your code  
[https://Date-Test-Array.manun2.repl.co](https://Date-Test-Array.manun2.repl.co)

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 2, 2021, 8:44pm UTC](https://community.glideapps.com/t/agent-for-information/29981/74 "2021-09-02T20:44:05Z")

</div>

Hi, @gvalero  
I’m not upset, but it works for me !!!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/f/ff1ff8b088996bbaec754daa4303f086674adcc4.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/9/99b90692689f7980119678495b6dc87115ac2732.png)

and english too

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/6/46c0e15dff4542fa93303505e1a3e30e6fcf0324.png)

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 2, 2021, 8:50pm UTC](https://community.glideapps.com/t/agent-for-information/29981/75 "2021-09-02T20:50:16Z")

</div>

~~can you make a screen image of your column array lk\_array~~

~~because I use a split column, that’s the only difference~~

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 2, 2021, 8:57pm UTC](https://community.glideapps.com/t/agent-for-information/29981/76 "2021-09-02T20:57:24Z")

</div>

Sure!

The fastest way (and newest) to create an array is to use a lookup on any column

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/f/5fb0838d7b0e018ce3d5a91098d55434721d7522.png)

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 2, 2021, 8:58pm UTC](https://community.glideapps.com/t/agent-for-information/29981/77 "2021-09-02T20:58:33Z")

</div>

AH but you have medium and long inverse !!! 🤔 🤔 🤔 🤔 🤔

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 2, 2021, 9:01pm UTC](https://community.glideapps.com/t/agent-for-information/29981/78 "2021-09-02T21:01:34Z")

</div>

> [@Manu.n](#):
>
> you have medium and long inverse !!!

what do you mean with **inverse**? 🤔

That is how Glide shows me the data, there is no defined order so far

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 2, 2021, 9:02pm UTC](https://community.glideapps.com/t/agent-for-information/29981/79 "2021-09-02T21:02:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/f/ef319a17b73b8c30f9aa311a998cb92eb7ddde46.png)

this is MEDIUM, not long !!!

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 2, 2021, 9:09pm UTC](https://community.glideapps.com/t/agent-for-information/29981/80 "2021-09-02T21:09:27Z")

</div>

Ah, I can see that you create an array doing:

1. Joint List and later
2. Split Text

It’s too much work for me 🤣

My arrays are based on a lookup on any column directly and maybe is the problem source.

Glide and its things 😉

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [September 2, 2021, 9:14pm UTC](https://community.glideapps.com/t/agent-for-information/29981/81 "2021-09-02T21:14:40Z")

</div>

No, it works with the Lookup, I did the test.

I mean you just have to change the Array Date Format parameter, in your examples you just have to change the medium to long and long to medium **in the YC column**!!!  
If you match the source date column format and YC array it works.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/3/a3072952a329a2ad37d50487ec14508a90dc7509.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/2/92262d484c5531ade5a2a6ebaa669c5e984691c5.png)

and then it’s magic 🥳

[Previous page](https://community.glideapps.com/t/agent-for-information/29981.md?page=3)

[Next page](https://community.glideapps.com/t/agent-for-information/29981.md?page=5)
