Jump to content

Convert Squarespace timestamps to real date / time?

Recommended Posts

I'm trying to make some customizations to the events page, but the timestamps Squarespace provides are somehow strange: 

so e.g. this is

startDate: 1657643425538

If I do 
 

var date1 = new Date(1657643425538).toString()

startDate.toString(date1) // Tue Jul 12 2022 19:30:25 

 

But the correct date set for the event is Friday 23, 2002, 9 AM.

 

So what am I doing wrong? or what would be the best way to transform timestamp into correct date / time?

 

image.thumb.png.20f1b166dea51e0ade58f6495fbfa4e8.png 

Link to comment

Can you provide a few details about your ultimate goal? What are you trying to change about the Events page?

Also, it is always helpful if you can provide a public link to the page you are working on so that we can see what you're seeing. 

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
  • 10 months later...

I think timezone has been taken into account, so you have to assign correct timezone to the date value

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 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.