Transform or rule

Hi

If you have 2 dates and you want to subtract for example hire date(in future) and current date(now)

We want to say for example if a person is 7 days or less from “hire date” it must give an output value if it is 8 days or more it must give another output value

How would you got about that. I see that there are two transforms “Date Math” and “Date Format”

It points more to both(using “date math” within “Date Format”) but is cannot seem to find an example of this.

Or do we need to use a rule for this?

Any examples that somebody has will be greatly appreciated

To use dateMath the date must be in the iso8601 format which is why dateFormat needs to be used. Here’s an example of a transform that uses both:

{
	"attributes": {
		"hrOnLeave": {
			"attributes": {
				"values": [
					{
						"attributes": {
							"attributeName": "ON_LEAVE",
							"sourceName": "WorkDay"
						},
						"type": "accountAttribute"
					},
					"null"
				]
			},
			"type": "firstValid"
		},
		"idnLCState": {
			"attributes": {
				"firstDate": {
					"attributes": {
						"input": {
							"attributes": {
								"values": [
									{
										"attributes": {
											"attributeName": "HIREDATE",
											"sourceName": "WorkDay"
										},
										"type": "accountAttribute"
									},
									{
										"attributes": {
											"value": "01/01/2999"
										},
										"type": "static"
									}
								]
							},
							"type": "firstValid"
						},
						"inputFormat": "PEOPLE_SOFT",
						"outputFormat": "ISO8601"
					},
					"type": "dateFormat"
				},
				"negativeCondition": {
					"attributes": {
						"firstDate": {
							"attributes": {
								"input": {
									"attributes": {
										"values": [
											{
												"attributes": {
													"id": "Deactivation Date"
												},
												"type": "reference"
											},
											{
												"attributes": {
													"value": "01/01/2999"
												},
												"type": "static"
											}
										]
									},
									"type": "firstValid"
								},
								"inputFormat": "PEOPLE_SOFT",
								"outputFormat": "ISO8601"
							},
							"type": "dateFormat"
						},
						"negativeCondition": "inactive",
						"operator": "gt",
						"positiveCondition": "active",
						"secondDate": "now"
					},
					"type": "dateCompare"
				},
				"operator": "gt",
				"positiveCondition": "prehire",
				"secondDate": "now"
			},
			"type": "dateCompare"
		},
		"value": "#if($hrOnLeave=='1' && $idnLCState == 'active')onLeave#else$idnLCState#end"
	},
	"id": "Lifecycle State",
	"type": "static"
}