Skip to content

Instantly share code, notes, and snippets.

View jeremyevans6's full-sized avatar

Jeremy D Evans jeremyevans6

  • Better Better Better Inc.
  • United States
View GitHub Profile
@jeremyevans6
jeremyevans6 / timezones.js
Created September 24, 2020 03:13
Time Zones for ShareTribe v10
//This file lives in app/assets/javascripts/
//It has to be required in app/assets/javascripts/application.js, not shown here
//
//It uses browser timezones to correct the client's display of dates and times in three areas of a Sharetribe site.
//By not changing the database, these times will always be UTC in the backend. Indeed, their values remain UTC for the client,
//though the display of the times in the DOM is modified.
const timeRegex = /((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))/g;
const daysOfWeekRegex = /(Sun|Mon|Tue|Wed|Thu|Fri|Sat)/g;