Does anyone who how I could put a date into a date field that is the last day of the currnet month? So if a Zap ran today (April) it would return the date: 30/04/2020
Best answer
How to insert the last day of a month into a date field
Best answer by ikbelkirasanBest answer by ikbelkirasan
const formatDigits = digit => String(digit).padStart(2, "0");
const d = new Date();
d.setDate(1);
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
d.setMonth(d.getMonth() + 1);
d.setDate(d.getDate() - 1);
const day = formatDigits(d.getDate());
const month = formatDigits(d.getMonth() + 1);
const year = d.getFullYear();
const lastOfMonth = `${day}/${month}/${year}`;
output = [{ lastOfMonth }];
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.