Jump to content

Change Text Color of date if expired (datediff)?


Recommended Posts

I have looked at the posts on this topic using a Yes/No field.  But would be possible to do it with  DATEDIFF?  

I have two simple fields.  A submit_date (timestamp)  and a deadline_date (text field as calendar popup).  The app requires a minimum of 30 days to complete a request.  So if someone submits a request (submit_date) and chooses a deadline date (Deadline)  that does not meet then 30 day minimum notice we need that Deadline date text to be read preferrably  (or the field background, or row).  Ive tried versions of this:
 

<div =id="visi [@field:Deadline]">

<script>
var isi = document.getElementById("visi[@field:Deadline]");
if DATEDIFF(day, [@field:Sub_date], [@field:Deadline]) <= 29 {
isi.parentNode.parentNode.style.backgroundColor = '#FFFFFF';
}
else{
isi.parentNode.parentNode.style.backgroundColor = '#66699';
}
</script>

</div>

and

 

CASE
WHEN ATEDIFF(day, [@field:Sub_date], [@field:Deadline]) <= 29 
THEN '<span style="color:red;">'[@field:Deadline]'</span>'
ELSE '<span style="color:#blue;">'[@field:Deadline]'</span>'
END
Link to comment
Share on other sites

  • 3 years later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...