SimplyRETS / simplyretswp

SimplyRETS Wordpress Plugin - Show your MLS listings on your website...simply.
http://wordpress-demo.simplyrets.com
GNU General Public License v3.0
21 stars 20 forks source link

Convert {lastUpdate} timestamp to local time #234

Closed CodyReichert closed 1 year ago

CodyReichert commented 1 year ago

Add JS snippet to localize {lastUpdate} timestamp.

CodyReichert commented 1 year ago

@WillPresley -- hey, how does this look to you? See my comment here on your PR.

I think this might be a slightly more robust solution to the problem you were solving in #230. Basically, this wraps the {lastUpdate} variable in a <span class="utcToLocal">. We then target that element with JS to localize the timestamp to the browser's timezone.

One reason I think this is more robust is Daylight Savings Time. With the manual admin setting, I would currently need to use "-5 hours", but outside of DST, I would need to use "-6 hours".

Does that sound like it will work for you? Happy to discuss further, as well!

CodyReichert commented 1 year ago

For reference, here is what this will look like (this screenshot is in my local CST/CDT):

image

WillPresley commented 1 year ago

@CodyReichert This makes way more sense to me, and is a much better solution for the reasons you already said. Just updated and tested on the same client's site, and it seems to be working well! I whipped together my solution too quickly and hadn't even considered the DST issue. Good call, and thank you!

(Random note, when checking this out, I noticed an extremely tiny typo in the 'No Search Results' area description: "The messasge shown when a search doesn't return results.")

CodyReichert commented 1 year ago

and hadn't even considered the DST issue. Good call, and thank you!

@WillPresley I don't think I would have noticed the DST issue either if we hadn't just had it a couple weeks ago :laughing:

I'll send a follow-up for that typo fix, thanks for pointing that out!