Hi,

do you want a calculation like: if expiry date = today show "Expired" ? If so that's not possible. see here: https://help.podio.com/hc/communities/public/questions/202577457-Determine-if-a-deliverable-is-overdue-and-display-Overdue-if-it-is-?_ga=1.164409081.716129646.1431329936

Or are you asking for another use case?

Rainer

Mr. Rainer;

I just want to Get Min.Date Between those 4 Fields

Ah ok, didn't get it that these are all date fields. sorry.
I'm sure there would be a more elegant way, but this works:

`````` dat1 = moment(@date 1).format("YYYY-MM-DD");
dat2 = moment(@date 2).format("YYYY-MM-DD")
dat3 = moment(@date 3).format("YYYY-MM-DD");
dat4 = moment(@date 4).format("YYYY-MM-DD");

var arr = [dat1,dat2,dat3,dat4]
var arr1 = arr.sort().join().split(",")
moment(arr1[0]).toDate()
``````

Instead of @date 1 etc. enter your date fields. The result is a date in date format which can be shown in a calendar. This formula is for calculating the dates in the same item.

Rainer
rg@delos-consutling.com

Thanks Mr. Rainer

It works Perfectly but I wish if All date fields are Blank than its Should be Blank instead of 01/01/1970

Then you have to tell the calculation: if all date fields blank show nothing.
Change last line:

``````arr.length == 0 ? null : moment(arr1[0]).toDate()
``````

If null doesn't work try "".
Rainer

Hi

Something Is wrong I tried "" Instead of null but Result is Same as earlier.

Sorry,my mistake.

Change last line to

``````arr1.join().replace(/[Invalid date,]/g, "") == "" ? null : moment(arr1[0]).toDate()
``````

Rainer

Thank you Mr. Rainer it works.

How do you get the max date instead of the min date?

Hi Dan,

just add .reverse() after .sort() to get the "youngest" (= max) date

`dat1 = moment(@Date 1).format("YYYY-MM-DD");dat2 = moment(@Date 2).format("YYYY-MM-DD");dat3 = moment(@Date 3).format("YYYY-MM-DD");var arr = [dat1,dat2,dat3].filter(function (i) { return i != "Invalid date"; }).sort().reverse();arr.length == 0 ? "" : moment(arr[0]).toDate() `

The filter function removes date fields which are empty.
Rainer

Thank Rainer!