Issue Comparing Joiner Timestamp with Current Date using $now() in IdentityNow

Hello everyone,

We are currently trying to compare a joiner’s onboarding date with the current date using compare timestamp in a IdentityNow workflow. The onboarding date is provided as an input and follows this format: 2020-04-27T16:48:33.597Z (example). To get the current date, we are using $now(), as explained in the JSONata documentation.

However, the comparison always returns false, and we are not sure if we are performing the comparison correctly. We suspect there may be an issue with the format or type conversion, so we’ve also tried different methods listed in Apache Velocity’s DateTool documentation, but none seem to work.

Has anyone encountered a similar issue or can suggest a proper way to handle this timestamp comparison?

Thanks for your help!

Hi @AntonioGvtt ,
I believe using Date compare Transform will be much easier in this case instead of velocity

Hi @AntonioGvtt ,

Use the Date Compare Transform for comparison as @gourab said.

Convert both dates to ISO8601 format.

I also, provide you the sample template.

{
    "name": "Test Date Compare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "attributes": {
                "input": {
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                        "sourceName": "<sourcename>",
                                        "attributeName": "<attributename>"
                                    },
                                    "type": "accountAttribute"
                            },
                            "5000-12-30T00:00:00"
                        ]
                    },
                    "type": "firstValid"
                },
                "inputFormat": "yyyy-MM-dd'T'HH:mm:ss",
                "outputFormat": "ISO8601"
            },
            "type": "dateFormat"
        },
        "secondDate": {
            "attributes": {
                "inputFormat": "yyyy-MM-dd'T'HH:mm'Z'",
                "outputFormat": "ISO8601",
                "input": {
                    "attributes": {
                        "expression": "now/d"
                    },
                    "type": "dateMath"
                }
            },
            "type": "dateFormat"
        },
        "operator": "lt / lte / gt / gte",
        "positiveCondition": "<result>",
        "negativeCondition": "<result>"
    },
    "internal": false
}

Also, check the date input format is correct as you mentioned in the transform.

I think, this would help you. Thanks!!

5 Likes

Hi @GOKUL_ANANTH_M ,

Thank you so much for your detailed response and for providing the sample template! I apologize for the delayed reply. I have implemented the Date Compare Transform as you suggested and followed the ISO8601 format. Your explanation has been really helpful, and the issue is now resolved.

Thanks again!

Best regards,
Antonio

1 Like

Glad to hear this. Thanks!! :slightly_smiling_face:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.