Closed mikeallbutt closed 2 years ago
@mikeallbutt like this ?
That looks good @jhenterprise , but @mikeallbutt are we sure this shouldn't be fixed in the API prior to recv'ing it in the app?
@jhenterprise, we use momentjs to translate dates per locale. Are you reusing that? I can point you to an example if you didn't already see it. Thx!
Yes, ideally it should be handled through an API endpoint, but don't know the overall architecture as in the web version I saw it is forcefully converted to locale DateTime(as in database this is saved object_note). First I tried react-native-intl but it is not working in android(Intl.DateTimeFormat not working in android), don't sure momentjs supports locale(but saw in post item hook)? I used javascript Date function to convert. Should I share the code?
Yeah, I think that the API should be sending it in the proper format. However, if we do want to translate dates in the app, let's reuse the moment
library since we are also using it to display per various locales. An example is found in PostItem.js
This is how dates are displayed on the theme. (always good to see how it is done there and do similar.
thanks, @zdmc23 . Done through momentjs nice and easy :) @mikeallbutt please check the attachment.
Thanks. Looks good.
The same thing needs to be done to the comments and activity screen too.
@jhenterprise please go ahead and issue a PR. Aa you may already know, if you have a commit message like: "Resolves #686 - (whatever text you want)" then GitHub will auto-close the Issue and reference the commit when the PR is merged. Thx!
The date in the logs are like
Baptism Date: {1654111560}
and need to be shown in the same way the app user wants depending on their device settings ie. dd-mm-yyyy or mm-dd-yyyy