formatDate Question

Confused by this one. Why are the dates one day off in the expression?

Screen Shot 2023-06-07 at 5.49.43 PM

Keep in mind the input and output types each function requires.

In the case of formatDate(), it expects a date in millis, but in your example you are providing it a string date so it’s guessing at the format (which defaults to UTC).

If you use the default formatter, you’ll see that it’s parsing the date as UTC and then formatting it to your location’s timezone (eg. UTC - 5).

If you first explicitly parse the date using the exact format it’s in, you’ll get the values you expect.

parsedDate = date($billingLastDate, 'YYYY-MM-DD')

1 Like

Thank you. I knew I was missing a point somewhere.

1 Like