[SOLVED] Getting the first day of month

Hello everyone, hoping you’re doing fine! :grin:

I just have a situation with dates. I want, by using code, to get the first day of the current month, and save it in a date input

For example, this current month (when I’m publishing this) is May, so when the user gets in, a date input will automatically show: (1/5/2023 - INT or 5/1/2023 - USA, however you want to use it)

It cannot be: a number or a text

It must be in date format , so the date input can read and save that info with no problem

Does anyone have an idea to this situation?

Thank you so much for your time and answer!

Hi,
try this:

let today = new Date()
let firstOfMonth = new Date(today.getFullYear(), today.getMonth(),1)

Hi, Qu4dri!

Thank you so much for your help, it really worked!

You’re awesome! :grin: