time-to-leave icon indicating copy to clipboard operation
time-to-leave copied to clipboard

Allow configuration of 12/24 hour day

Open tupaschoal opened this issue 6 years ago • 21 comments

Some people prefer one format over another, so it would be good to allow them to choose it.

Remember to remove the field "AM/PM" when in the 24h format

tupaschoal avatar Sep 17 '19 02:09 tupaschoal

Today the time inputs are using HTML input tag, which is a newer thing in HTML and follows the OS time configuration. In order to allow the user to select am/pm we must change to use some external API for Time picking.

thamara avatar Oct 12 '19 12:10 thamara

This and #12 might be solved with https://www.npmjs.com/package/timepicker. At least that's one idea.

NetizenAbel avatar Oct 19 '19 00:10 NetizenAbel

I've begun working on this using jquery-timepicker

https://github.com/kashaiahyah85/time-to-leave/tree/jquery-timpicker

NetizenAbel avatar Jan 13 '20 23:01 NetizenAbel

YAY

thamara avatar Jan 15 '20 01:01 thamara

@thamara can I work on this?

samin-batra avatar Oct 23 '20 18:10 samin-batra

Sure!

tupaschoal avatar Oct 23 '20 18:10 tupaschoal

Hey @samin-batra, any update on this?

thamara avatar Oct 28 '20 10:10 thamara

Hi @thamara , I am working on this. I am trying to use the jquery-timepicker to achieve this. However, I ran into some issues. JQuery-timepicker is not working as expected (could be some set-up and initialization issues). I am working on resolving those.

samin-batra avatar Oct 28 '20 10:10 samin-batra

I tried to achieve the same with the normal HTML time input but that doesn't work because it depends on the person's OS settings. Also, can we include some button at the top of the table which indicates 12/24h format? Or do we simply accept any kind of input?

samin-batra avatar Oct 28 '20 10:10 samin-batra

Thanks for the update!

I ran into some issues. JQuery-timepicker is not working as expected (could be some set-up and initialization issues). I am working on resolving those.

Feel free to join the discord channel if you want to discuss something. You can also open a Draft PR so we can take a look together.

Also, can we include some button at the top of the table which indicates 12/24h format?

I prefer to have this kind of setting on the preferences window as this is something that the users will most likely set just one time. If it's on the calendar it will be kind of polluting the GUI.

thamara avatar Oct 28 '20 10:10 thamara

I prefer to have this kind of setting on the preferences window as this is something that the users will most likely set just one time. If it's on the calendar it will be kind of polluting the GUI.

Makes sense. I'm checking and will get back.

samin-batra avatar Oct 28 '20 10:10 samin-batra

Hi @samin-batra, any updates on this?

thamara avatar Nov 08 '20 14:11 thamara

Hi Thamara. I was able to get the timepicker working but now the other validations don't seem to be working. I am trying to understand what the flow is related to validations. I haven't been able to work on this recently.

samin-batra avatar Nov 08 '20 14:11 samin-batra

Thank for the update. When you have the time to work on this, let us know if we can help with anything.

thamara avatar Nov 09 '20 00:11 thamara

After different tries, we keep hitting the issue of HTML's input time being tied to the OS. In order to support this we need to migrate to another solution, maybe something like moment.js library.

thamara avatar Oct 15 '21 08:10 thamara

Hello. Is this issue still active? If yes I'd like to try to solve it. I'd appreciate a short reply before I start contributing. Thank you (:

Madiena avatar Apr 19 '22 15:04 Madiena

Hey @Madiena, feel free to tackle it :) Let me assign it to you.

araujoarthur0 avatar Apr 20 '22 00:04 araujoarthur0

Hey @Madiena, just a heads-up, in the past, other people have tried to tackle this issue, and what we found out is that there's no way of doing such thing in vanilla html/javascript. To do so, we need an external library, something like https://www.npmjs.com/package/timepicker. Feel free to take a look, and suggest what you believe should be done. :)

thamara avatar Apr 20 '22 02:04 thamara

Just to be clear: the only page that's affected by this issue would be the preferences page. Am I right?

Madiena avatar Apr 22 '22 15:04 Madiena

The main window too, but it depends on your region configuration to show or not the AM/PM

tupaschoal avatar Apr 28 '22 23:04 tupaschoal

No external Library required for this to work. When selecting the language in the settings, you also have to change the language of electron. For testing, this can be done by appending --lang=de to the time-to-leave executable.

time-to-leave.exe --lang=de

This should also be changeable in the code and has to be set during the startup:

app.commandLine.appendSwitch('lang', 'en')

So when changing the language, a restart is required to change the date-time format when the appendSwitch method is used during startup.

I would love to see this implemented because AM/PM time formats give me headaches 😉

Sources: https://www.electronjs.org/docs/latest/api/command-line-switches#--lang

soulflyman avatar Jul 31 '23 09:07 soulflyman