We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DateTimePickerAdv Bug

Hi Guys,

I *think* I have found a bug with the DateTimePickerAdv - I have replicated the problem in the attached sample project.

The scenario is this: I have created a DateTimePickerAdv on a form amongst other controls. The DateTimePickerAdv has a custom format of "dd - MMM - yy" and is then bound (through DataBinding) to a DateTime property on an object that contains all of the data for the controls. As the DateTimePickerAdv only displays two years, it correctly shows "07" when I bind a value of "2007". However, clicking away from the DateTimePickerAdv and then clicking back again seems to change the year value to "1907" for no apparent reason. If I change the custom format to "dd - MMM - yyyy" it works fine, but unfortunately, the requirement is to only display 2 year digits and not 4. Can you please confirm whether this bug exists and whether there will be a fix required?

Thanks!

Regards,
Russell

DateTimePickerAdvBug.zip

9 Replies

HA haneefm Syncfusion Team September 4, 2007 06:26 PM UTC

Hi Russell,

You can try setting the DateTimePickerAdv's DigitYear property is set to 2000 and let me know if this helps.

Thank you for the interest shown in Syncfusion Product.

Best regards,
Haneef


RC Russell Coombes September 5, 2007 09:13 AM UTC

Hi Haneef,

This does not help me at all.

Setting this value *does* prevent the year from changing from 2007 to 1907. But all this does is reverse the bug. Assume that I have a value of '1987' on an object bound to the DateTimePickerAdv. Clicking away from the DateTimePickerAdv and then clicking back to it causes the value to change to 2087, which is incorrect behaviour.

The 'Digityear' property is used when the user only adds the last two digits of the year - so if a user types '95' and the DigitYear is '2000' then the year value on the control becomes '2095' which is correct. However - just clicking away from the DateTimePickerAdv and clicking back again *should not* change the original value of the DateTimePickerAdv in any way at all.

I still consider this to be a bug that requires a fix.

Your feedback is much appreciated.

Regards,
Russell

>Hi Russell,

You can try setting the DateTimePickerAdv's DigitYear property is set to 2000 and let me know if this helps.

Thank you for the interest shown in Syncfusion Product.

Best regards,
Haneef


HA haneefm Syncfusion Team September 5, 2007 03:39 PM UTC

Hi Russell,

Thank you for your update.

One way you can solve this issue by handling the Leave event of the DateTimePickerAdv control and set the DigitYear property. Below are the codes that show this task.

dateTimePickerAdv1.Leave += new EventHandler(dateTimePickerAdv1_Leave);
dateTimePickerAdv2.Leave += new EventHandler(dateTimePickerAdv1_Leave);

void dateTimePickerAdv1_Leave(object sender, EventArgs e)
{
DateTimePickerAdv dTimePicker = sender as DateTimePickerAdv;
if (dTimePicker != null)
{
dTimePicker.DigitYear = ((int)(dTimePicker.Value.Year /100)) * 100;
}
}

Best regards,
Haneef


RC Russell Coombes September 10, 2007 10:43 AM UTC

Hi Haneef,

I'm afraid that this solution is no good to us. We may have many, many DateTimePicker controls on a form, and we cannot be expected to add this EventHandler for every single DateTimePickerAdv control that exists. Furthermore, this control will exist all through our application, so again, it is unreasonable that we'll have to keep adding this EventHandler all through our code.

Again, I re-iterate that the Year value is changing on its own by clicking off and back onto the DateTimePickerAdv - the value is NOT being changed manually by the user. Therefore, I believe that this is a bug with the control, and I would like a fix for it from Syncfusion that doesn't require me to have to update every single DateTimePickerAdv in our entire application.

Regards,
Russell

>Hi Russell,

Thank you for your update.

One way you can solve this issue by handling the Leave event of the DateTimePickerAdv control and set the DigitYear property. Below are the codes that show this task.

dateTimePickerAdv1.Leave += new EventHandler(dateTimePickerAdv1_Leave);
dateTimePickerAdv2.Leave += new EventHandler(dateTimePickerAdv1_Leave);

void dateTimePickerAdv1_Leave(object sender, EventArgs e)
{
DateTimePickerAdv dTimePicker = sender as DateTimePickerAdv;
if (dTimePicker != null)
{
dTimePicker.DigitYear = ((int)(dTimePicker.Value.Year /100)) * 100;
}
}

Best regards,
Haneef


RC Russell Coombes September 14, 2007 08:56 AM UTC

Hi Haneef,

I really need an update to this problem. Is this a recognised Syncfusion bug?

Regards,
Russell

>Hi Haneef,

I'm afraid that this solution is no good to us. We may have many, many DateTimePicker controls on a form, and we cannot be expected to add this EventHandler for every single DateTimePickerAdv control that exists. Furthermore, this control will exist all through our application, so again, it is unreasonable that we'll have to keep adding this EventHandler all through our code.

Again, I re-iterate that the Year value is changing on its own by clicking off and back onto the DateTimePickerAdv - the value is NOT being changed manually by the user. Therefore, I believe that this is a bug with the control, and I would like a fix for it from Syncfusion that doesn't require me to have to update every single DateTimePickerAdv in our entire application.

Regards,
Russell

>Hi Russell,

Thank you for your update.

One way you can solve this issue by handling the Leave event of the DateTimePickerAdv control and set the DigitYear property. Below are the codes that show this task.

dateTimePickerAdv1.Leave += new EventHandler(dateTimePickerAdv1_Leave);
dateTimePickerAdv2.Leave += new EventHandler(dateTimePickerAdv1_Leave);

void dateTimePickerAdv1_Leave(object sender, EventArgs e)
{
DateTimePickerAdv dTimePicker = sender as DateTimePickerAdv;
if (dTimePicker != null)
{
dTimePicker.DigitYear = ((int)(dTimePicker.Value.Year /100)) * 100;
}
}

Best regards,
Haneef


RC Russell Coombes September 18, 2007 04:49 PM UTC

Hello,

I am still waiting for a response from Syncfusion regarding this issue, some 14 days after I posted the incident on this forum.

It is one thing to ship your product with bugs. It is then another to ignore forum posts regarding the matter.

Please confirm whether the issue I have raised is a genuine bug, and advise when this issue will be resolved.

Regards,
Russell


>Hi Guys,

I *think* I have found a bug with the DateTimePickerAdv - I have replicated the problem in the attached sample project.

The scenario is this: I have created a DateTimePickerAdv on a form amongst other controls. The DateTimePickerAdv has a custom format of "dd - MMM - yy" and is then bound (through DataBinding) to a DateTime property on an object that contains all of the data for the controls. As the DateTimePickerAdv only displays two years, it correctly shows "07" when I bind a value of "2007". However, clicking away from the DateTimePickerAdv and then clicking back again seems to change the year value to "1907" for no apparent reason. If I change the custom format to "dd - MMM - yyyy" it works fine, but unfortunately, the requirement is to only display 2 year digits and not 4. Can you please confirm whether this bug exists and whether there will be a fix required?

Thanks!

Regards,
Russell

DateTimePickerAdvBug.zip


HA haneefm Syncfusion Team September 24, 2007 05:55 PM UTC

Hi Russell,

My sincere apologies for this delay in responding.

Currently, there is no built-in support for this. But one way you can do this by deriving the DateTimePickerAdv control and override the OnLeave method to set the DigitYear property of the DateTimePickerAdv. Below are the codes that shows this task.

public class MyDateTimePicker : DateTimePickerAdv
{
public MyDateTimePicker(): base(){}
protected override void OnLeave(EventArgs e)
{
this.DigitYear = ((int)(this.Value.Year / 100)) * 100;
base.OnLeave(e);
}
}

If still the issue exists, please create a direct trac incident in this regard and we can discuss further on this issue.

Also please do let me know if you have any other technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef


RC Russell Coombes September 26, 2007 12:51 PM UTC

Hi Haneef,

I am unsure what you mean by 'no built-in support for this'. The DateTimePickerAdv is able to display Dates and Times, using a format that I specify (so long as the format string is valid). So it most DEFINATELY does have support for this. It's just that the control is buggy - and rather than admit it, I keep getting 'bodge-job' answers.

Do you seriously expect me to take a year number, divide it by 100, and then multiply it by 100 again? Furthermore, to complete your suggestion, I will have to ensure that every single DateTimePickerAdv control that we have in our entire project is changed to use a derived control that contains your hack just to prevent the Syncfusion DateTimePickerAdv from changing a value that it should not have changed in the first place.

As I have no reasonable resolution, I will take this issue to Direct-Trac.

Regards,
Russell


>Hi Russell,

My sincere apologies for this delay in responding.

Currently, there is no built-in support for this. But one way you can do this by deriving the DateTimePickerAdv control and override the OnLeave method to set the DigitYear property of the DateTimePickerAdv. Below are the codes that shows this task.

public class MyDateTimePicker : DateTimePickerAdv
{
public MyDateTimePicker(): base(){}
protected override void OnLeave(EventArgs e)
{
this.DigitYear = ((int)(this.Value.Year / 100)) * 100;
base.OnLeave(e);
}
}

If still the issue exists, please create a direct trac incident in this regard and we can discuss further on this issue.

Also please do let me know if you have any other technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef


HA haneefm Syncfusion Team September 26, 2007 10:54 PM UTC

Hi Russell,

Thank you for creating the DirectTrac Incident. Your incident has been updated. Please feel free to reply the incident if you have any queries.

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon