Jump to content

JS Add x business days to today's date (moment.js)

Recommended Posts

Hi,

I've got a bit stuck on something I am trying to achieve. I offer a few different postage methods which take anywhere from 2 days to 14. The issue I have is people often never account for what is a working day, in an effort to clear things up I'd like to achieve the an estimated delivery date onsite. I've been looking at moment.js as it seems that it has the capability to highly customise this adding not only working days but accounting for public holidays you specify.

Basic version
Take today's date and add x working days to it to output an estimated delivery date.

Better version
The above but factor in the time the order was placed to either count it in the calculation or start from the following day eg Thurs 9am order starts on Thurs, however a Thurs 10pm order starts on Friday.

Has anyone done anything similar with a commerce site?

Thanks

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

On 2/21/2022 at 3:28 PM, PHOME said:

Hi,

I've got a bit stuck on something I am trying to achieve. I offer a few different postage methods which take anywhere from 2 days to 14. The issue I have is people often never account for what is a working day, in an effort to clear things up I'd like to achieve the an estimated delivery date onsite. I've been looking at moment.js as it seems that it has the capability to highly customise this adding not only working days but accounting for public holidays you specify.

Basic version
Take today's date and add x working days to it to output an estimated delivery date.

Better version
The above but factor in the time the order was placed to either count it in the calculation or start from the following day eg Thurs 9am order starts on Thurs, however a Thurs 10pm order starts on Friday.

Has anyone done anything similar with a commerce site?

Thanks

Can you have some screenshots of the result you want to achieve? Moreover, sharing your site with the protected password could help a lot

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.