Marmo / debitum

free and libre IOU tracker for Android
GNU General Public License v3.0
85 stars 7 forks source link

Date decreased by 1 day after finishing Date Picker #28

Closed Marmo closed 3 years ago

Marmo commented 3 years ago

Originally posted by @mezysinc in https://github.com/Marmo/debitum/issues/14#issuecomment-864320877

Debitum_1_1 Debitum_2_1 Debitum_3_1

Marmo commented 3 years ago

Well that's strange. I did then understand you correctly but cannot reproduce this.

I had a look into the code and the only thing I can think of is some issues relating to locale settings. Three questions:

Marmo commented 3 years ago

That was the right scent :) If I set my timezone to GMT-5 I can reproduce this.

So I will have to dig into the locale thing. Damn, hoped I could avoid this by using standard locale everywhere XD

Marmo commented 3 years ago

Note to self: the problem is probably

  1. I get a Date from the Date Picker that is ms from epoch in the device's timezone
  2. I save this Date to to the viewModel and later to the Transaction/database
  3. I display it using a formatter that uses the device's locale/timezone again and interprets the Date from the viewmodel as UTC, adjusting it using the locale's timezone.

Step 3 (timezone adjustment) should not be done as debitum does not care about locales timezones and the Date from the database should be used as-is. The problem occurs only when a timezone GMT-x (not +x) is used, as addition of hours does not change the date while subtraction does.

So I think I should always use a GMT+0 locale timezone upon turning the Date into a String!

Marmo commented 3 years ago

that seems to have fixed it. It will be release 1.3.0 that is to be released soon

Marmo commented 3 years ago

Hi @mezysinc , let me comment on your ideas:

indicate returned amount in money list

since Debitum does not know about how much money was returned (return-transactions are not linked to the initial transaction, see here why), this can not be implemented

view stays focused on the same position & doesn't focus on newly added transaction

this was #2 and I fixed it in v1.3.1

I believe it would be good to change word 'GAVE' (in transaction) and replaced it with either 'RETURNED' or 'GAVE BACK' for easier understanding

You mean when using the shortcut for returning money the radio buttons should be labeled differently? Gonna think about this. The labelling then would have to depend on the direction of the initial transaction:

initial label RECEIVED for return txn label GAVE for return txn
Person gave to user got back (no change)
Person received from user (no change) returned / gave back

I fear this could make it clearer for some people while leading to confusion for others. Still not sure if I will pick up this idea...

PS: feel free to open separate issues even for smaller ideas, as this makes tracking, adding them to milestones and discussing them a lot easier!