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 mode property not ok? #22

Closed
PsychoAndi opened this issue Feb 1, 2020 · 5 comments
Closed

24h mode property not ok? #22

PsychoAndi opened this issue Feb 1, 2020 · 5 comments
Assignees

Comments

@PsychoAndi
Copy link

PsychoAndi commented Feb 1, 2020

This is the way I'm calling the Picker:

MyPicker.drawColSeperatorLines = True
MyPicker.LocalizationInt = 6
MyPicker.StartYear = DateTime.Now.Year - 3
MyPicker.EndYear = DateTime.Now.Year + 3
MyPicker.SelectedDate = DateTime.Now
MyPicker.TimeMode = 24
MyPicker.flashSeparator = False
MyPicker.Invalidate(False)
MyPicker.Show

and when I try to read the selected date/time (in the DateTimeWindow code, where I created a button with an action event) with:
ProgramWindow.chosenDate = self.SelectedDate
System.DebugLog("Datum = " + ProgramWindow.chosenDate.ToString(Locale.Current, DateTime.FormatStyles.Medium, DateTime.FormatStyles.Short))

I get the following:
Datum = 01.02.2020, 04:16

When I change the MyPicker.TimeMode to 12 it's:
Datum = 01.02.2020, 16:16

The picker itself displays the 24hour-mode correctly, but the property .SelectedDate does not.

@mikecotrone
Copy link
Owner

When I started this project I didn't really pay attention to people switching live in code from 12 to 24 --> I only added this on the UI demo as a courtesy for demoing only. It is undefined on how the behavior works from converting 12 <--> 24 in code.

Is this of value for you in your software? I can add this feature properly if so.

@PsychoAndi
Copy link
Author

I try to make an application that is used in the US and Germany at the same time. For now I have my own conversation of the time formats, but it'll be shorter and cleaner to have this directly from the chooser...

@mikecotrone
Copy link
Owner

Thanks for the feedback - I will start a sprint to add/fix this behavior.

@npalardy
Copy link
Collaborator

npalardy commented Apr 1, 2020

Dates, and DateTimes, dont have a notion of the "representation"
That is a function of how the data in the date instance is formatted

@npalardy
Copy link
Collaborator

npalardy commented Apr 8, 2020

Something like the following will format the date using a german locale (one that uses 24 hr form in writing)
Note that if you want the date in one form and the time in another then a single locale may not suffice

Dim local As Locale = Locale.Current
Dim german As New Locale("de")

Dim currentTime As dateTime = DateTime.Now

Dim localTimeStr As String = currentTime.ToString( local, DateTime.FormatStyles.Medium, DateTime.FormatStyles.Short )
Dim germanTimeStr As String = currentTime.ToString( german, DateTime.FormatStyles.Medium, DateTime.FormatStyles.Short )

Break

@npalardy npalardy closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants