


Hello everyone,
I try to get in my HTML delivery something like this with the date and make a personalization, here is my example :
You can travel between the 01/04/2022 until the 15/05/2022
So I want to get the first day of the current month until another day + 45 days for example.
Is something like this possible with personalization ? Can someone help me on this possible code ?
Thank you in advance for your help.
Kind regards.
EDIT :
I successfully got the first day of current month with this :
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
Result
<%= formatDate(firstDay, "%2D/%2M/%4Y") %>
Question remain is, how to get the other date + 45 days based on the firstDay ?
Thank you for your help.
Views
Replies
Sign in to like this content
Total Likes
Hello @thibaultb473199 ,
for example taken from https://stackoverflow.com/questions/563406/how-to-add-days-to-date
Date.prototype.addDays = function(days) { var date = new Date(this.valueOf()); date.setDate(date.getDate() + days); return date; } var date = new Date(); console.log(date.addDays(5));
Marcel
Hello @thibaultb473199 ,
for example taken from https://stackoverflow.com/questions/563406/how-to-add-days-to-date
Date.prototype.addDays = function(days) { var date = new Date(this.valueOf()); date.setDate(date.getDate() + days); return date; } var date = new Date(); console.log(date.addDays(5));
Marcel