saucepleez / taskt

taskt (pronounced 'tasked' and formely sharpRPA) is free and open-source robotic process automation (rpa) built in C# powered by the .NET Framework
http://www.taskt.net/
1.06k stars 346 forks source link

24h format #280

Open pablosanz7 opened 2 years ago

pablosanz7 commented 2 years ago

Hi! I can't work with 24h format while calculating dates, how can I solve it? For example, when I subtract 30 minutes in 18:00 it goes down to 5:30 and not to 17:30... Thanks!

pablosanz7 commented 2 years ago

@Faro1991 @saucepleez @naga1992 @mondemonde

Faro1991 commented 2 years ago

So, after checking this, the problem here is/was two-fold:

  1. Custom date and time format separators - if the specified DateTime string matches an already existing one (e.g. the default value is the default invariant string), it'll just get converted to your local culture. Thus, e.g. 01/14/2022 in en-US culture will always become 14.01.2022 when run on a machine with e.g. de-DE culture.
  2. The hh/HH difference. According to the doc on custom date and time format strings, h and hh will always use a 12h clock and only HH utilizes the 24 hour clock. As far as I'm concerned there's two edit: three ways we can solve this:
    1. Always use the user's culture for reference (bad, because the user might want to have a 12/24 hour clock)
    2. Specify the difference in the UI (makes usage clear and doesn't take customization options away from the customer)
    3. Implement a checkbox that allows the user to freely switch between formats.

edit: for all three I'd also suggest implementing a short preview that allows the user to double-check their settings.

I'll shortly start a pull request to fix the first issue, the second I'll leave upon until we've agreed on how to continue.

pablosanz7 commented 2 years ago

Thank you @Faro1991 ! One last question, the Excel command 'Get Last Row Index' gives me always the index of the first column of the current workbook (A column), no matter which column I select to check. For example if I select in the command to get the index of the column C that is actually 4 and the index in the A column is 3, it will take the 3. How can I solve it? Thank you.

Faro1991 commented 2 years ago

I'm pretty sure it's related to the setting not getting converted property, but I'll take a closer look later today. There's this part that I think resets your setting to A in every case:

 if (String.IsNullOrEmpty(columnLetter))
{
    columnLetter = "A";
}
Faro1991 commented 2 years ago

Ok, quick feedback: I'm pretty sure it's this part, but I don't have access to a machine with Excel installed so there's no way for me to verify. If anyone could check that specific variable (columnLetter) in the debugger, I'm like 90% confident that it's not being set properly and therefore reset to "A".

pablosanz7 commented 2 years ago

Thanks @Faro1991 for your time, it means a lot for me! I have one last question, maybe you can help me... if I want to delete an element from a list variable and keep the others, how could I do it? For example my list variable contains A,B,C,D,E and I would like to eliminate the element C (second index - it starts on 0) to convert the list variable in A,B,D,E. Thanks for the help!

pablosanz7 commented 2 years ago

Why my date 07/02/2022 (7 of february of 2022) changes to 02/07/2022 (2 of july of 2022) when I set it in an Excel cell? How can I solve it? Thanks! @Faro1991 @saucepleez