fromy Posted May 31, 2014 Report Share Posted May 31, 2014 Hi. I have a table holding two fields with dates I try to compare in java script. The first date is generated by caspio timestamp, and called "date_submitted", formatted like"05/15/2014 23:43:58" in the table. The second date,"Date_event_start", is a date submitted from a Caspio calendar, formatted like "05/30/2014" in the table. When i insert both dates in a HMTL block within Caspio they retur quite different. "date_submitted" returns: "05/15/2014 11:43:58 PM" and "Date_event_start" returns: "30.05.2014" Why does Caspio default output different date formats??? I want to compare the dates with a simple script like: <HTML> [@field:Late_submitted] <a id="visi[@field:ID_delegate]"> <script> var isi = document.getElementById("visi[@field:ID_delegate]"); if('[@field:date_submitted]' >= '[@field:Date_event_start]'){ isi.parentNode.parentNode.style.backgroundColor = '#FFB0AD'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#ADD8E6'; } </script> </HTML> How can i make the different date fields comparable??? --- Frode --- Quote Link to comment Share on other sites More sharing options...
Jan Posted June 1, 2014 Report Share Posted June 1, 2014 Hi Frode, Is it a Result page of a Report DataPage? On Configure Results Page Fields step, select your date. In the Field options, there is the Formatting field. I think, you can click the "Edit" button and select the same format for both dates. On my DataPages i selected "Localization" for both fields and they work. Quote Link to comment Share on other sites More sharing options...
fromy Posted June 1, 2014 Author Report Share Posted June 1, 2014 Hi Jan. Yes, it is a Result page of a report Datapage. The formatting field solved it for me. i had to include all date fields in the result page to make sure they where equally custom formatted. To bad there is on option to hide fields you don`t want, but still need to format. Thank you. --- Frode --- Quote Link to comment Share on other sites More sharing options...
Jan Posted June 2, 2014 Report Share Posted June 2, 2014 Hi Frode, As far as I know, this format is defined in your Localization (the article about formatting). Then you can use fields that are not displayed on the Result page. Quote Link to comment Share on other sites More sharing options...
RuisiHansamu Posted August 9, 2023 Report Share Posted August 9, 2023 Hello! There is an updated forum post that you may want to check out here: This explains how you can achieve it via rules or JS. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.