nicorac / bcr-gui

BCR-GUI is a companion app for the great BCR (Basic Call Recorder) Android application and other supported ROMs with embedded call recorders.
https://coolsoft.altervista.org
GNU General Public License v3.0
138 stars 7 forks source link

AM/ PM custom date formatting doesnt work, leaves a's unformatted #75

Closed updooter closed 6 months ago

updooter commented 6 months ago

I believe this file on line 65 needs to have a and A letters inside that function call, so like YMDHAhmsa instead of YMDHhms https://github.com/nicorac/bcr-gui/blob/b72326e92d823b95cf498efe1619db141dfdb77d/src/app/pipes/datetime.pipe.ts#L65

nicorac commented 6 months ago

You're right, it misses Aa chars. Just to have a "real" case to test it on, could you please post your own format string here?

updooter commented 6 months ago

You're right, it misses Aa chars. Just to have a "real" case to test it on, could you please post your own format string here?

YYYY-MM-DD hh:mm A

nicorac commented 6 months ago

Ok, fixed and cleaned it up a bit (more readable) 😉 I've also removed 2 unsupported options, Z and ZZ, from format help text.

https://github.com/nicorac/bcr-gui/commit/cbc04e50e52d298a6ff785ee93ca97c53a4ceca4

PS: I'd like to also fix #63 before releasing an update. I don't know if you've ever used BCR 12-hours format in filenames; if so, could you please post some sample filenames, formatted in 12h format, for me to test the parsing algorithm? My doubt is: how should I manage the value 12 in hours together with AM//PM flag?

updooter commented 6 months ago

i dont use the 12h format in the bcr filenames, however i think you could just convert them into 24h like this: (hour, flag) -> (hour % 12) + (flag == "AM" ? 0 : (flag == "PM" ? 12 : error()))

nicorac commented 6 months ago

I've found this page with a lot of examples, so I've been able to adapt your code to BCR-GUI and test it with real examples... it now works.

Just released v1.4.1 with both fixes.

Thanks for your help 👍