Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24h format #280

Open
pablosanz7 opened this issue Jan 10, 2022 · 7 comments
Open

24h format #280

pablosanz7 opened this issue Jan 10, 2022 · 7 comments

Comments

@pablosanz7
Copy link

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
Copy link
Author

@Faro1991
Copy link
Contributor

Faro1991 commented Jan 14, 2022

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
Copy link
Author

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants