-
Notifications
You must be signed in to change notification settings - Fork 72
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
Feature/date format #76
Conversation
@KurtMar thank you for this pull request. This is great work. I would only add some kind of custom format validator but another option is to have the users specify a locale not a specific format. https://momentjs.com/docs/#/i18n/changing-locale/ So we could globally load this locale and all the dates / etc will be rendered accordingly. We would end up with a little less code hopefully. Then we could also use the localisation of Antd like shown here in the docs: Moment has a long list of locales available so I would not be worried that something is not available: |
@madisvain Thanks for the input. Setting the locale from a list sounds like a good idea. Do you want to get rid of the formatting functions all together and call moment directly from inside the view components or is it ok to keep using them? I have time to refactor to using moment locales, but for the date picker I would still use moment to format the date for now. Also since the default locale for moment will give us a format of MM/DD/YYYY, if we still want to use the default YYYY-MM-DD for undefined locale, that would require some logic and those functions would hold that. |
@madisvain I went along and changed it to use locales. There's also a custom default locale that will ensure that the current default date formatting is kept. Feel free to make further suggestions or modifications if needed. Especially where to set the user's custom moment locale is something I struggled with. It is currently set when the user opens the Invoices page. I'm not a huge fan of the mutable and global nature of moment, but this seems to be a working solution. |
PR no longer relevant after rewrite to Tauri |
Closes #71
Affects invoice form, invoice and date picker. If there is a better way of getting the organization's settings to the utility functions, then it would simplify things a bit. NOTE: New translation string in invoice settings.