mainIine / foe-helfer-extension

FoE Helfer - Extension for chromium based browsers and Firefox ;-)
https://foe-helper.com
GNU Affero General Public License v3.0
121 stars 183 forks source link

Date formatting in guild treasure export #2450

Open stopyra opened 2 years ago

stopyra commented 2 years ago

Date recived from server is exported without any changes. It causes a problem when we try to combine many exports to one place. For example 'today' date from one export may not be the same 'today' date from another export. It will be nice if Helper could convert the relative date by using universal format. It can use unix time format with days, months and years as numbers e.g. 2022-05-10T20:00+00:00. If you do not want to change it permanently you can add it as an option to turn on.

Please look at my fork where I have made some changes to see if it is possible. I used existing method from eventhandler to process dates.

Gindi4711 commented 2 years ago

The function EventHandler.ParseDate can only parse date values that are less than 1 week old. This if perfectly fine for MoppelHelper as events are only stored for about 6 days anyway.

But guild treasury logs can be older than that so we would need to adapt this function to deal with Datestrings in the form of "on dd.mm.yyyy at hh:mm:ss" as well and we need to do that in 20+ ingame languages.

This is the reason why I decided to just 1:1 forward date strings and not deal with it because it was not worth the effort.

stopyra commented 2 years ago

Hi, You are right, EventHandler.ParseDate does not work corectly with dates older then 6 days. I fixed it by adding 'other' regex for numeric dates. All my changes are in dev branch in my fork. In addition I have made an option in window settings to turn on date formatting. It is turned off by default.

knwpsk commented 2 years ago

+1 for this date-formatting request

Also: when you export the file, the filename is "GBG-export". Would be nice if it was renamed " Treasury Transactions export" like some of the other export files.

Thank you!

stopyra commented 2 years ago

Gindi4711, what else should I add to get these changes merged?