Pool-Of-Tears / GreenStash

Simple FOSS android app to help you plan and manage your savings goals easily and establish the habit of saving money.
https://pooloftears.in
MIT License
583 stars 48 forks source link

Unable to correctly handle 24-hour and 12-hour time formats #149

Closed goddaneel closed 1 month ago

goddaneel commented 2 months ago

Steps to reproduce

  1. Click on "Income/Expenses".
  2. Modify the time by clicking on the Time of Day option.
  3. Select a time greater than 12:00. For example, 20:00.
  4. Click Apply, then Save.

Expected behaviour

Save and display as 20:00 or 8:00 pm .

Actual behaviour

Save and display as 8:00 am .

Device name

oneplus ace3

Android version

android 14

GreenStash version

3.7.0 (f-droid)

Device logs

No response

Additional information

No response

starry-shivam commented 2 months ago

Click on "Income/Expenses".

Sorry but there isn't any Income/expense button or screen I'm aware of, Can you please provide bit more details to reproduce this?

goddaneel commented 2 months ago

Sorry but there isn't any Income/expense button or screen I'm aware of, Can you please

Sorry, it should say withdraw/deposit (+/- buttons in compact view).

starry-shivam commented 2 months ago

Sorry, it should say withdraw/deposit (+/- buttons in compact view).

Thanks, yes I'm able to reproduce it now, will try to fix it in next update.

goddaneel commented 2 months ago

Sorry, it should say withdraw/deposit (+/- buttons in compact view).

Thanks, yes I'm able to reproduce it now, will try to fix it in next update.

Thanks and looking forward to your next update.

One more thing, I just found that in English environment, I can modify the year, month, and day, but in Simplified Chinese environment, I can only modify the day. I don't know if this is a bug or intentional.

starry-shivam commented 2 months ago

One more thing, I just found that in English environment, I can modify the year, month, and day, but in Simplified Chinese environment, I can only modify the day. I don't know if this is a bug or intentional.

I'll have to look into this, thanks for reporting. I'll get back to you once I've some information regarding that

starry-shivam commented 2 months ago

So, I looked into this and couldn't really figure out what's going wrong from my end to cause incorrect behavior in the Chinese locale. So, I browsed some open issues on sheets-compose-dialogs (the library I use to show calendar and datetime dialogs) and found this: https://github.com/maxkeppeler/sheets-compose-dialogs/issues/57. I think this may be the reason why it's not working properly in the Chinese locale.

Regarding the other issue of the incorrect AM/PM, I was indeed able to reproduce it on my real device (Xiaomi POCO F5/Redmi Note 12 Turbo), where it didn't work in both 24-hour format and 12-hour format (It didn't even show me the option to select AM/PM in 12-hour format). However, for some reason, it seems to work fine on Android Studio's emulator?! I really have no idea why. I think it's also some problem or bug with the library, though I can't say for sure.

I also found this issue: https://github.com/maxkeppeler/sheets-compose-dialogs/issues/53, which I personally agree with. It took me quite a few tries to understand how it's supposed to work, and I believe it could be confusing for users as well.

Considering all of this, I think it would be wise to switch to the standard Android library at least for the datetime picker, or maybe look at some other alternatives because there seem to be multiple issues with the current implementation.

starry-shivam commented 1 month ago

I found an easier way to fix most of these issues by manually setting the locale in datetime-picker's config. I'll go with this for now, as it fixes all of the aforementioned issues apart from https://github.com/maxkeppeler/sheets-compose-dialogs/issues/53 with just one line of change. Regarding https://github.com/maxkeppeler/sheets-compose-dialogs/issues/53, nobody has complained about it yet, so I'll sleep on it for the time being.