Feature - Client local time #11
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This small PR provides a nice little feature on top of a somewhat bug-fix.
Previously, the back-end was passing date values to the react front-end without a timezone. And while this project delivers on the best-practice of using UTC timezones for the back-end, that doesn't play so well once the data is passed to a front-end. See, browsers date handling (MomentJS's included) assumes that all time-zone-less date/time values are in the same time-zone as the client browser. Unfortunately that meant that the times in the timeline were always off by 5 hours for me (I'm in EST). This PR fixes that issue by always passing an ISO-8601 (includes timezone) date string to the front-end to handle.
While fixing that issue was ideal, this PR also aims to subtly improve the user experience of "PHP RFC Watch" by using the power of MomentJS's relative time handling. Now, when displaying times in the event timeline, we'll display a relative time in a more semantic HTML5
time
tag (falls back to a span for older browsers). To give more clarity and to uphold an expected UI pattern, thetime
tag also uses thetitle
attribute to provide a fully detailed time string when hovering over the element. Finally, we use thetime
tag's semantic data format to provide a client-parsable date format so that javascript extensions and added browser behaviors could be powered by the raw data. :)Finally, I added a very small margin to the clock icon that prefixes the actual date string in the UI, just to relieve a minor cluttered appearance that I found when testing the date strings.
I'm really loving this project! Thanks for the awesome work. 😃