Squarespace snippet: Responsive World Clock

I found an interest question on squarespace forum about creating a world clock on website, that mean a digital clock which is:

  • Display current date

  • Display current time, counting

  • Show current user timezone/location

  • Display on top right of the website on desktop and in the middle of header on mobile

  • The time changes accordingly based on where you are

  • And most important thing, the clock style must be identical to current site’s look and feel

I then contact the owner and we agreed to create the plugin using javascript/html and embed to the page via custom code injection, the clock will display on all pages

  • I used plain javascript to place the clock markup in the site

  • Moment js is used to get user timezone, there is another option to detect user location via ip

  • Settimeout() method used to make the counting of second and update the current time

If you got similar requirements and would need my help, kindly contact me directly for discussion

Previous
Previous

Understanding Squarespace Image Delivery and Optimization

Next
Next

Squarespace Workflow: Connect Order to Mailchimp