Assigning specific date to date property without using date input

Hi,

Is anyone tried or maybe aware of how to assign a specific date to the date property in the database directly without using the date input component?

I already tried to assign no formatting date like this “2023-01-01T00:00:00Z” (01/01/2023) to date property in the database directly but I’m getting this
image

FYI -

Hi @ishantanusrivastava,

Did you try to get the day number (along with time) and put this into this property? Adalo stores dates as a number of days since 01/01/1970, 0:00 GMT+0.
Convert Seconds & Days Since Year 0-1970, look at “Days since 1970”.

Best,
Victor.

Hi @Victor ,

Thanks for your reply, I am able to get the result with the help of the link -

But suppose the year is over

Let’s assume that we are in 2024 then again we need to update the no. of days manually, what I need is no matter what year it is, it should put the quarter 1 date range without using date input.

Start Date & End Date for quarter 1

01/01/2024 | 31/03/2024

Looking forward to your reply.

Thanks

Hi @ishantanusrivastava,

I would suggest to create a collection with dates for quarters and use it as a source. It might be complicated to calculate the number of days using a formula (due to leap years). I did this long time ago but it turned out to be much easier to use predefined values.
Another option is to use Make and create a scenario which returns the date (you can use AddMonths / AddYears functions in Make). This will cost some Make credits, of course.
And the third option is to use Arbitary Javascript component - but again, you’ll be on your own if it doesn’t work correctly.

Hope this helps.

Best regards, Victor.

Hi @Victor ,

Thanks for all the time you have given to this thread much appreciated. In the end, I created a collection a few days back already ( I get this idea a few days back). But I was waiting for an answer in the hope that it may be possible.

Thanks
Shantanu

Maybe with JavaScript like Victor mentioned? :eyes:

Video

https://vimeo.com/808627404

JS Code
const now = new Date();
const year = now.getFullYear();
const quarters = [];
for (let quarter = 1; quarter <= 4; quarter++) {
  const quarterStartMonth = (quarter - 1) * 3;
  const quarterStartDate = new Date(year, quarterStartMonth, 1);
  const quarterEndDate = new Date(year, quarterStartMonth + 3, 0);
  quarters.push({
    quarter: quarter,
    startDate: quarterStartDate,
    endDate: quarterEndDate
  });
}
const Start = quarters[0].startDate.toLocaleDateString('en-GB');
const End = quarters[0].endDate.toLocaleDateString('en-GB');
const firstQuarterDateRange = `${Start} - ${End}`;

return firstQuarterDateRange;

Thank you

Hi @dilon_perera ,

You have been very helpful, but the javascript component only works with the web version not on both platforms, but I will consider this if I use the web version.

you can use zapier to do it they have a code component that you can host the code inside it

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