Get all Sundays of next month

Hi,

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)

Has someone knows how to achieve this please ?

Thanks

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

‘2023-02-06’, ‘2023-02-13’, ‘2023-02-20’, ‘2023-02-27’

Hey Taro
I would prefer to get it as unix timestamp because I need to save it in the database and add it in a calendar.

But you can still share your proposition :slight_smile:

Thanks

Hi @Ennocom,

Welcome to the community :partying_face:

Correct? :eyes:

Thank you

HI @dilon_perera ,

Thanks! Indeed I am new to the community :slight_smile:

This is exactly what I want to achieve!!

I have some questions:

  • How do you integrate Javascript in Adalo ?
  • Does it take a lot of space ? Because I am still using the free version

Thanks

Awesome! I’ll create a video of how I did this and send it here!

It’s the Arbitrary JavaScript component made by Pragmaflow! Currently we couldn’t download components from their site. For download them you can follow these steps : Every new beginning comes from some other beginnings end - #48 by James_App_Maker And Pragmaflow created a video of this way too : Installing Adalo Github components walkthrough - YouTube

No. It’s just a component :+1:

Hi,
Ok let me know when you have the video ready.
I will get the component on my side.

Thanks

@dilon_perera, just to let you know I could finally install the Adalo Arbitrary Javascript component in my Adalo account

Awesome! I’ll send the video soon!

Hi @Ennocom,

Here’s the video! : Get Sundays of a month.mp4 - Google Drive

Sorry for the lateness!

JS Codes
Next Month First Date
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 :+1:

Thank you

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.