I am looking for a way to get the beginning of next month with epoch timestamp calculation.
I can see in this post that there is something similar for weeks but not for month.
So for example if we are 2023-01-03, I would like the calculated timestamp to be 2023-02-01.
Then I need to get every Sundays of that specific month (5, 12, 19, 26 of Feb)
If there is a way to return them as pure text, would that do the trick? keeping in mind that you can still perform “Contains” filtering on the output, Something like
var d = new Date("rrr");
var next = d.setMonth(d.getMonth() + 1, 2);
var next = d.toISOString().slice(0, 10)
return next;
Get Sundays
var date = new Date("rrr");
var d = new Date(rrr,rrr,0);
var n = d.getDate();
var Sunday = new Date("");
Sunday.setDate(date.getDate() - (date.getDay()||7) + 7);
var get_sunday_date = Sunday.getDate();
var a = (Sunday.getDate());
var b = (Sunday.getDate() + 7);
var c = (Sunday.getDate() + 7 + 7);
var d = (Sunday.getDate() + 7 + 7 + 7);
var e = (Sunday.getDate() + 7 + 7 + 7 + 7);
var get_sunday_month = Sunday.getMonth() + 1;
if (get_sunday_month < 10) {
var get_sunday_month = "0" + (Sunday.getMonth() + 1);
} else {
var get_sunday_month = Sunday.getMonth() + 1;
}
var get_sunday_year = Sunday.getFullYear();
if (a < 10) {
var a = "0" + a;
}
if (b < 10) {
var b = "0" + b;
}
var a = get_sunday_year + "-" + get_sunday_month + "-" + a;
var b = get_sunday_year + "-" + get_sunday_month + "-" + b;
var c = get_sunday_year + "-" + get_sunday_month + "-" + c;
var d = get_sunday_year + "-" + get_sunday_month + "-" + d;
var e = get_sunday_year + "-" + get_sunday_month + "-" + e;
var f = (Sunday.getDate() + 7 + 7 + 7 + 7)
if (f > n) {
var all = a + "," + b + "," + c + "," + d;
var all = all.split(",", 5)
} else {
var all = a + "," + b + "," + c + "," + d + "," + e;
var all = all.split(",", 5)
}
return all;
Next Year
var date = new Date("rrr");
var year = date.getFullYear();
return year;
Next Month
var date = new Date("rrr");
var month = date.getMonth() + 1;
return month;
Add One By One
const array1 = rrr;
let index = rrr;
var item = array1.at(index)
return item;
In the JS codes replace the rrr with the respective values like in the video