Skip to main content

So I am in the process of automating some offboarding and onboarding work and idk if I'm running into a weird bug / edge case or if i am miss using functions and expression builds, but I'm essentially try the isolate the last work date and the request and get the difference in hours , so i can set a timer for that many hours to complete next steps. but tapping into the offboarding placeholder requires initial formatting because it comes in MM-DD-YYYY format but most the date/time functions require YYYY-MM-DD despite both being labeled as iso. I tap into the liquid filters with date and am able get my conditions to test but when i try to extract the difference be ticket date and last work date tapping directly into the datetime placeholder from offboarding and formatting with liquid filters I'm getting wild inaccurate negative numbers

diffInHours({{current_date_and_time}},'2024-11-09T11:45:00Z') = 43 *This Work

 

diffInHours({{current_date_and_time}}, {{ticket.offboarding_request.actor_1.cf_last_work_day_amp_time | date : "%FT%R:00Z"}}) = -1372 *This doesn’t

I have tried a hand full of combinations of formatting the offbarding time and it still yield this number and i just don’t know where in the documents to address this. 

Looks like formatting is the main issue here. Have you tried using date: "%Y-%m-%dT%H:%M:%S" in your Liquid filter? This format should standardize it to match ISO, which could help the diffInHours function return accurate values.


Thank you for you response I found the issue is the initial date taken from the offboarding is formatted as mm/dd/yyyy but all date functions are yyyy-mm-dd, so day and month are getting mixed up when formatting from mm-dd-yy, so the actually number was right it was wrong because month and day are being swapped


Reply