Filtering Javascript Date field

58 views
Skip to first unread message

David Cazarez

unread,
Jan 21, 2023, 12:58:38 PM1/21/23
to mementodatabase
Hi, I have a Javascript field that pulls in a DATE from a date field from another library.  Is there a way to filter that date that has been pulled in, using the same method as if it was the original date field?

When I go to set a filter on the Javascript field I use to bring in a date, it gives me the option to choose to FIlter by number or Filter by string.

Is there a way to set the filter as if a Date field? (by week, month,custom..I hope the picture help with my question.)
If not, is there a solution i may be missing?

This is what I used (and selected the momement.min.js Library)
moment(field("Service")[0].field("Date")).format("l")

I have read the forums, wiki, used grasshopper, other sources and im not good at javascript but I do try

Not sure but I think there is a similar post but it did not involve dates.

20230121_091945.jpgScreenshot_20230121-091850_Memento Database.jpg20230121_091818.jpg

Craig Hunter

unread,
Jan 21, 2023, 2:58:52 PM1/21/23
to David Cazarez, mementodatabase
My first thought was to have a date field in the library with your javascript field and have trigger scripts that keep that field updated to the value of the javascript field. Problem is there is no trigger for record changed in other library.

I could be wrong, but I thought it was impossible for a javascript field to change other field values in its record.

I think it would be easier with link to entry if it is possible.
Craig

Craig Hunter

unread,
Jan 21, 2023, 3:20:36 PM1/21/23
to David Cazarez, mementodatabase
lookup fields do not allow filtering and grouping as dates even when the lookup field is connected to a date field.

I do not have time to research the javascript trigger solution.
Craig

Er Mo

unread,
Jan 21, 2023, 3:24:22 PM1/21/23
to mementodatabase
Hallo
Das Datum ist eine Eigene Sache , weil es nicht als Datum behandelt wird .Dein Rechner zählt die Millisekunden die siet den 1.1.1970 vergangen sind . Aus dieser Großen Zahl errechnet er das Datum ( Uhrzeit )  und gibt es in deiner Landesüblichen Form aus . Das JS Feld kann diese als Zahl  oder als Text in Datumsform ausgeben . Mit beiten kannst du warscheinlich nicht viel anfangen .

Hi
The date is a separate matter because it is not treated as a date. Your calculator counts the milliseconds since 1/1/1970. From this large number, it calculates the date (time) and outputs it in your country's customary form. The JS field can output this as a number or as text in date form. You probably can't do much with beiten.

Ernst
Reply all
Reply to author
Forward
0 new messages