scottleedavis / mattermost-plugin-remind

a mattermost plugin that sets reminders for users and channels.
Apache License 2.0
186 stars 44 forks source link

Improve 24h time format handling #164

Open andrey-yantsen opened 5 years ago

andrey-yantsen commented 5 years ago

Summary

Treat 11:30 as 11:30AM. I understand that there are lots of people who using AM/PM, but some parts of the world just haven't had a chance to get used to it. I have 24hrs enabled in my mattermost client, so I'm expecting all times to be in that format, therefore when I'm asking something like /remind me poke Josh at 11:30 when it's 1PM already, I'm expecting the reminder to be set for tomorrow 11:30AM, and not for today 11:30PM.

Describe alternatives you've considered

As for now I have to always type AM/PM to not get the misunderstanding, but it's kinda painful when you haven't been using AM/PM at all in your entire life.

scottleedavis commented 5 years ago

This is perhaps best achieved with a system console config option on the plugin, enabled in the chooseClosest func.

andrey-yantsen commented 5 years ago

Nice idea, but I'm not sure if it'll meet everybody needs: i.e. we have users from London, UK and from Austin, US, and I'm not sure whether everybody would be happy with forcing to use either AM/PM or 24h.

scottleedavis commented 5 years ago

Great point. Next idea is to check the 12/24 clock setting of the user, and parse accordingly based on that.

Screen Shot 2019-09-03 at 11 08 57 AM

Preliminary inspection of the model.User object don't show this, but with some more digging I will find it. Perhaps stored in Props? https://github.com/mattermost/mattermost-server/blob/master/model/user.go#L59-L90

andrey-yantsen commented 5 years ago

Yeah, this one is the best option, I think. Not sure about Props, but web client gets it from /api/v4/users/me/preferences, use_military_time=true means 24-hour clock enabled.

VincentSC commented 5 years ago

FYI: 12-hour only in these countries: am pm (Quebec also primarily 24 hours, by the way. As does the US military, as it is weirdly used in the API)

So the main part of the world uses 24 hours system.