maybe-finance / maybe

The OS for your personal finances
https://maybe.co
GNU Affero General Public License v3.0
28.71k stars 2.19k forks source link

Allow users to configure their locale and provide a default date format based on locale #909

Open thelooter opened 2 weeks ago

thelooter commented 2 weeks ago

Currently, dates are presented as mm/dd/yyyy. This is not intuitive for many people, and has lead to multiple wrong entries for me. Having the ability to configure how you want the date to be presented would be really helpful

claudey commented 2 weeks ago

This is an interesting problem I may want to solve.

thelooter commented 2 weeks ago

I probably should have mentioned that before, but I would to use dd/mm/yyy notation

zachgoll commented 1 week ago

I think @vsme had a good start to this in #889. While we cannot accept bulk translations right now, I think this would be a good opportunity for us to configure the ability for users to set their preferred locale.

Since date formats are set once for locale, this would be a small enough scope for us to introduce without adding much overhead.

The requirements should probably be something like:

I think we'll want to set the locale via the strategy outlined here:

https://edgeguides.rubyonrails.org/i18n.html#setting-the-locale-from-user-preferences

@justinfar do we have some designs for this that we could post on this issue?

justinfar commented 1 week ago

On it!

justinfar commented 1 week ago

Just added a page in the community file

Here's how it's looking:

image

I've basically just added a Soon tag (that we use within the Security page) within the language field and added the Date format field with 5 of the most common date formats.

zachgoll commented 1 week ago

@justinfar looks good to me!

This issue is up for grabs for anyone who wants to tackle it. Otherwise I'll circle back and knock it out after some of the investment portfolio work I'm doing.

thelooter commented 1 week ago

Another idea would be still activating the locale selection with a note next to it stating that it only applies to dates for now. This would already put the data in a model that can easily be applied to other things. That way you could gradually add more places to use it, like the date or the default suggested Currency

But i dont know enough about the codebase to judge if this is a viable solution

MagnusHJensen commented 2 days ago

I could be very interested in trying to implement the date format selection and persisting it, as a first issue in this repo!

If anyone else would like to do so as well, feel free since I'm not well versed in ruby, so it'll most likely take some time for me, and I respect others being faster :D

MagnusHJensen commented 2 days ago

I've being looking a tiny bit into this.

I can see with translations (locales) this should maybe be doable, where you can provide a format that works for that specific locale, so it's hard to if you don't have other languages yet. (Could of course add it to the english version, and then it's set up for any other locales)

If going for the dropdown with options no matter what locale you choose, then there needs to be a list of pre-defined formats (Maybe the options currently present in figma?)

It then comes down to two other things:

I can also see in the transaction lists, the date is already formatted nicely.

image

I can though see there is places where the date string is used as is, like here:

image

I'm assuming it's the last case where this really have an effect?