invalid date and/or time error when I try to add an event

Need help with VueMinder Pro or Ultimate? Ask your questions here.
eclipse79
Posts: 10
Joined: Wed Oct 13, 2010 4:33 am

Re: invalid date and/or time error when I try to add an even

Post by eclipse79 » Tue Oct 19, 2010 5:20 am

VueSoft wrote:Well, there's no solution yet, but I've thought of a few more things to try.

The code is pretty simple. I'm just using the .NET functions provided by Microsoft for parsing the date and time. Based on Microsoft's documentation, it's supposed to always work, for all Windows cultures. For some reason it doesn't. Here's the code (C#). Maybe you can see something here I've missed:

Code: Select all

                     
DateTime date = DateTime.Today;
DateTime time = DateTime.Now;

if (DateTime.TryParse(ultraCalendarComboStartDate.Text, out date))
{
   if (!ultraCheckEditorAllDay.Checked)
   {
      if (DateTime.TryParse(
         DateTime.Today.ToShortDateString() + " " + ultraComboEditorStartTime.Text,
         CultureInfo.CurrentCulture,
         DateTimeStyles.AllowWhiteSpaces, 
         out time))
      {
         dateTime = date + time.TimeOfDay;
         valid = true;
      }
      else
      {
         if (showError)
         {
            MessageBox.Show(
               "An error occurred parsing the specified time. The time string was " +
               ultraComboEditorStartTime.Text + ".\n\nA valid format would be " +
               DateTime.Now.ToShortTimeString(),
               "Error Parsing Start Time");
         }
      }
   }
   else
   {
      dateTime = date;
      valid = true;
   }
}
else
{
   if (showError)
   {
      MessageBox.Show(
         "An error occurred parsing the specified date. The date string is " +
         ultraCalendarComboStartDate.Text + ".\n\nA valid format would be " +
         DateTime.Today.ToShortDateString(),
         "Error Parsing Start Date");
   }
}
Hello,
i haven't tested yet the code, but I have seen this line:

DateTime.TryParse(
DateTime.Today.ToShortDateString() + " " + ultraComboEditorStartTime.Text,
CultureInfo.CurrentCulture,
DateTimeStyles.AllowWhiteSpaces,
out time)

I imagine that I have to replace DateTime.Today.ToShortDateString() with "date", isn't it?

eclipse79
Posts: 10
Joined: Wed Oct 13, 2010 4:33 am

Re: invalid date and/or time error when I try to add an even

Post by eclipse79 » Tue Oct 19, 2010 7:31 am

Hello,
I have made some tests. I have attached the project file and both the results of xp and 7.

In XP I can use ":" and "." as separator for hours-minute. So, if I write 11.13 or 11:13 it works fine.
In Windows 7 I can use only ":" as separator. Using "." causes an error in coversion of the date. In my opinion, when you populate the combo box containing the hours, you should use the separator used by the system. In the log files you'll find the content of variables used in the project, and the content of datetime function of .net. As you can notice, invoking DateTime.Now in Windows 7 you get 19/10/2010 13:43:24 (with ":" as separator). Invoking the same function in Windows XP, you get DateTime.Now: 19/10/2010 13.43.30 (with "." as separator).

I hope it helps :)
Attachments
log Windows 7.txt
Windows 7 Log
(591 Bytes) Downloaded 357 times
log windows xp.txt
XP log
(574 Bytes) Downloaded 344 times
testcalendar.rar
Test project
(54.58 KiB) Downloaded 345 times

User avatar
VueSoft
Dan Chartrand
Posts: 3851
Joined: Sat Aug 23, 2008 12:39 am
Location: St. Louis, Missouri, USA
Contact:

Re: invalid date and/or time error when I try to add an even

Post by VueSoft » Tue Oct 19, 2010 9:12 pm

Thank you for the information! I thought I was populating the time combobox with values consistent with the current Windows regional format, but it must not be doing this correctly in all cases. I'll make some updates and will try to have a beta completed by next week. Thanks again!
:idea:
Dan Chartrand, Founder
VueSoft LLC | St. Louis, Missouri, USA

eclipse79
Posts: 10
Joined: Wed Oct 13, 2010 4:33 am

Re: invalid date and/or time error when I try to add an even

Post by eclipse79 » Wed Oct 20, 2010 2:14 am

VueSoft wrote:Thank you for the information! I thought I was populating the time combobox with values consistent with the current Windows regional format, but it must not be doing this correctly in all cases. I'll make some updates and will try to have a beta completed by next week. Thanks again!
:idea:
Hello Dan,
I'm happy to see that you'll modify VueMinder for win7 italian users. Could you please alert me when the beta will be available for download?

Bye
Fabio

User avatar
VueSoft
Dan Chartrand
Posts: 3851
Joined: Sat Aug 23, 2008 12:39 am
Location: St. Louis, Missouri, USA
Contact:

Re: invalid date and/or time error when I try to add an even

Post by VueSoft » Wed Oct 20, 2010 5:15 pm

Yes, I'll let you know when it's ready.
Dan Chartrand, Founder
VueSoft LLC | St. Louis, Missouri, USA

User avatar
VueSoft
Dan Chartrand
Posts: 3851
Joined: Sat Aug 23, 2008 12:39 am
Location: St. Louis, Missouri, USA
Contact:

Re: invalid date and/or time error when I try to add an even

Post by VueSoft » Fri Oct 22, 2010 12:37 pm

A beta is available. You can download it here. Before installing, first ensure VueMinder isn't running by right-clicking the task tray icon and selecting "Exit".

Please let me know if this doesn't fix the problem. Thanks!
Dan Chartrand, Founder
VueSoft LLC | St. Louis, Missouri, USA

eclipse79
Posts: 10
Joined: Wed Oct 13, 2010 4:33 am

Re: invalid date and/or time error when I try to add an even

Post by eclipse79 » Tue Oct 26, 2010 3:30 am

VueSoft wrote:The new beta is linked below. Could you please try this version and let me know if it fixes the problem?
http://www.vueminder.com/download/VueMi ... _BETA3.exe
Dan, this link does not work :(

User avatar
VueSoft
Dan Chartrand
Posts: 3851
Joined: Sat Aug 23, 2008 12:39 am
Location: St. Louis, Missouri, USA
Contact:

Re: invalid date and/or time error when I try to add an even

Post by VueSoft » Tue Oct 26, 2010 4:58 pm

I think you were looking at one of my earlier posts. Here's the link:
http://www.vueminder.com/download/VueMi ... _BETA3.exe
Dan Chartrand, Founder
VueSoft LLC | St. Louis, Missouri, USA

eclipse79
Posts: 10
Joined: Wed Oct 13, 2010 4:33 am

Re: invalid date and/or time error when I try to add an even

Post by eclipse79 » Wed Oct 27, 2010 3:28 am

Dan,
it works great! :D

Can I have the installer of lite version?

Thank you
Fabio

User avatar
VueSoft
Dan Chartrand
Posts: 3851
Joined: Sat Aug 23, 2008 12:39 am
Location: St. Louis, Missouri, USA
Contact:

Re: invalid date and/or time error when I try to add an even

Post by VueSoft » Wed Oct 27, 2010 9:18 pm

I'm glad that fixed it! Here's the link for the Lite version beta:
http://www.vueminder.com/download/VueMi ... _BETA1.exe
Dan Chartrand, Founder
VueSoft LLC | St. Louis, Missouri, USA

Post Reply