Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use moment to render dates everywhere #1114

Merged
merged 1 commit into from
May 6, 2017
Merged

Use moment to render dates everywhere #1114

merged 1 commit into from
May 6, 2017

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Apr 29, 2017

Also changes dates to be rendered like 29 April 2017.

@xPaw xPaw added the Type: Feature Tickets that describe a desired feature or PRs that add them to the project. label Apr 29, 2017
Copy link
Member

@astorije astorije left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some concerns. This is not a 👎 but rather a discussion on what to do optimally until we localize everything (help needed on that :p)

lastWeek: "L", // Locale
sameElse: "L"
lastWeek: "MMMM DD, YYYY",
sameElse: "MMMM DD, YYYY"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a win. That way of displaying dates is only common in very few countries, so relying on locales is safer (unless I'm missing something).

I think this should be dealt with when internationalizing the client, and left alone until then.

Copy link
Member Author

@xPaw xPaw Apr 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think locale formatting is not that good, especially when we can't specify that we want the longer representation. The format I chose here is not american, but rather a sane approach to formatting dates, where full month name is displayed. This removes any confusion that there can be for "is it month or day?"

Also good read on the topic: https://www.troyhunt.com/10-lessons-for-uncultured-web-developers/ (see 2.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ah, calling me uncultured much? :D

I would be arguing if the entire app was consistent, but since we are not even consistent with one format (I thought we were, with the American one, but didn't realize we had 16:30, I'm just too vested in this format to see it!), then not so much.

I do think we'll need to bring back this discussion when we localize the whole client, but until then, I'm convinced (especially with the conversion from 02-04 into 2 May. Or is it 4 February? :D)

However, since we're here, let's go for DD MMMM YYYY. It feels more balanced (no need for a comma to visually separate day and year), it represents 10 times more populations than the alternative according to your link, etc. (it's also the standard date format for W3C standards :D)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(especially with the conversion from 02-04 into 2 May. Or is it 4 February? :D)

It'd be 2 April anyway :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goddammit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the comma? DD MMMM, YYYY

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://en.wikipedia.org/wiki/Date_format_by_country and others, it looks like 1 May 2017 is the most common, May 1, 2017 is essentially US-only, but 1 May, 2017 exists virtually nowhere.

Do you mind if we go for the first of the 3 versions?

module.exports = function(time) {
return new Date(time).toLocaleString();
return moment(time).format("MMMM DD, YYYY – HH:mm:ss");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment here and above. While the previous change (L to MMMM DD, YYYY) forces an American standard, this one will change from 4:30:00 AM to 16:30:00, actually parting from the American standard. So even if we forget about internationalization and go for an opinionated change, there is a loss of consistency in the standard used.
(Though currently tooltip show 4:30:00 AM but message time shows 16:30... Ah, if only we had proper localization :D)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, messages already use 24 hour format, and so will this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my comment in parens betrayed me. I never really noticed that 12/24h format difference before today.

Same comment as before though, I'd advocate for DD MMMM YYYY, HH:mm:ss.


return h + ":" + m;
module.exports = function(time) {
return moment(time).format("HH:mm");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this for #98 implementation to avoid conflicts. Hope it will be merged soon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it's a "Show seconds" checkbox and not a time format text input, then it should be fine 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a "Show seconds" checkbox, don't worry 😆

@xPaw xPaw added this to the 2.3.0 milestone Apr 29, 2017
@astorije
Copy link
Member

astorije commented May 1, 2017 via email

Copy link
Member

@astorije astorije left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super sweet!

screen shot 2017-05-02 at 00 08 08

screen shot 2017-05-02 at 00 08 13

@xPaw xPaw merged commit fe77563 into master May 6, 2017
@xPaw xPaw deleted the xpaw/moment branch May 6, 2017 10:43
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
Use moment to render dates everywhere
@AlMcKinlay AlMcKinlay removed their assignment Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants