Hi everyone, could you please kindly help me on this?
is there any script to take the last day of the month?
For example in below picture, current month is Jun. So i want day will be 30. if Feb, output is 28, or output is 31 for Mar
For simplicity sake I’d suggest using the inbuilt Luxon library that ships with more recent n8n versions. This avoids importing functions with NODE_FUNCTION_ALLOW_EXTERNAL.
To get the last day of the month you could use this in an expression {{ $today.set({ day: 1 }).plus({ months: 1 }).minus({days: 1}).toISODate() }}
Hi @H_nh_Nguy_n, you can format dates by replacing .toISODate() with .toFormat('L/d/yyyy'). Check out this list for all tokens you can use in .toFormat().
To preview a workflow simply select and copy your workflow from the n8n canvas and then paste it here on the forum using the preformatted text option on a new empty line:
not sure if this is what you’re asking for, but if you want to filter or select dates that fall within the last month, here’s one way of doing it:
start of last month: