Date & Time Status

Date & Time Status

Status

if(empty(prop("Date & Time")), "", if(formatDate(end(prop("Date & Time")), "L") == formatDate(now(), "L"), "🟩", if(formatDate(end(prop("Date & Time")), "L") == formatDate(dateAdd(now(), 1, "days"), "L"), "🟦", if(end(prop("Date & Time")) < now(), "🟥", format(ceil(dateBetween(dateSubtract(dateSubtract(end(prop("Date & Time")), hour(end(prop("Date & Time"))), "hours"), minute(end(prop("Date & Time"))), "minutes"), now(), "hours") / 24))))))
Explanation
if(empty(prop("Date & Time")), "",
If Date & Time is empty, display nothing.
if(formatDate(end(prop("Date & Time")), "L") == formatDate(now(), "L"), "🟩",
Otherwise if Date & Time formatted as MM/DD/YYYY matches the current date formatted the same, display 🟩
if(formatDate(end(prop("Date & Time")), "L") == formatDate(dateAdd(now(), 1, "days"), "L"), "🟦",
Otherwise if Date & Time formatted as MM/DD/YYYY matches the current date with 1 day added formatted the same, display 🟦
if(end(prop("Date & Time")) < now(), "🟥",
Otherwise if Date & Time is less than the current date, display 🟥
format(ceil(dateBetween(dateSubtract(dateSubtract(end(prop("Date & Time")), hour(end(prop("Date & Time"))), "hours"), minute(end(prop("Date & Time"))), "minutes"), now(), "hours") / 24))))))
Otherwise if none of the above return true, take Date & Time and convert all times back to 12:00am by using dateSubtract to remove the hours and then minutes, get the number of hours between the current date and the updated date and time, divide that number by 24 hours to get the decimal number of days, then round that number up (when using days the number is rounded down by default).
💡
end() is used each time to always grab the second time if there is one. This will default to the first date if only one is set.
 
By Ben  •  Latest  •  Was this helpful? Please consider buying me a coffee. Cheers!By Ben  •  Latest  •  Was this helpful? Please consider buying me a coffee. Cheers!
By BenLatest • Was this helpful? Please consider buying me a coffee. Cheers!