DJDavid98/HammerTime

Persist timestamp in url

Closed this issue · 5 comments

wei commented

Thanks for the awesome project. Is there anyway you could add support for ?t=xxxxxxxx in the query string when the dates are changed by the user?

This way we can easily share the url with others with the date time prefilled.

I'm not sure what your use case is, if you already have the timecode the tool's practically obsolete, you just need to add the rest of the formatting around it with the correct letter to be able to send it in Discord chat messages. If you're looking for a general-purpose "show this date in my timezone" website, https://everytimezone.com/ might be useful.

wei commented

My use case is to share this url https://hammertime.djdavid98.art/?t=1637244000 to event organizers so they can pick whatever style they need when sending discord announcements.

I weighed a few options on how best to implement this on the UI, and I ended up settling for adding a lock "button" at the end of the timestamp selection area, which will set the URL to match what you specified. It's technically a simple link, so you can right click to copy the URL as well. When the page is loaded via this URL parameter the date, time, and time zone pickers are locked to the provided timestamp in GMT. This should enable the use case you described.

wei commented

Wow fantastic! Thanks for the update!

Shall we should show the local timezone when locked? Just wondering if there is a reason for locking to GMT?

I deemed it unnecessary to handle translating the provided timestamp to the local time zone since the only requirement was to be able to copy the given timestamp in a specific format. Also, the previews already show you what the date looks like in many different formats.