DiscipleTools / disciple-tools-mobile-app

The React Native code base for the Disciple.Tools mobile app
https://disciple.tools/
16 stars 19 forks source link

Dates in logs are not user friendly #686

Closed mikeallbutt closed 2 years ago

mikeallbutt commented 2 years ago

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

IMG_20220621_220820.jpg

jhenterprise commented 2 years ago

@mikeallbutt like this ? disciple_tools_activity_log

zdmc23 commented 2 years ago

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!

jhenterprise commented 2 years ago

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?

zdmc23 commented 2 years ago

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

Screenshot from 2022-06-24 14-54-47

mikeallbutt commented 2 years ago

This is how dates are displayed on the theme. (always good to see how it is done there and do similar.

IMG_20220624_185908.jpg

jhenterprise commented 2 years ago

thanks, @zdmc23 . Done through momentjs nice and easy :) @mikeallbutt please check the disciple_tools_activity_log2 attachment.

mikeallbutt commented 2 years ago

Thanks. Looks good.

The same thing needs to be done to the comments and activity screen too.

zdmc23 commented 2 years ago

@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!