Don’t you hate it when a software component vendor disappears without warning?  In some of our applications, we use a custom datetime edit control named TPSCDateEdit.  This is part of a package from a company named puterSoft.  We have been using it for about 5 years and when we migrated our Delphi code to Delphi 2006, we got the Delphi 2006 version of their code.

Well, we discovered an annoying cosmetic bug.  If you exit a TPSCDateEdit control without entering in a date, the text of the control gets the date ’12/30/1899′.  12/30/1899 is the day that the world began if you are a COM based life form.  The control was saving the right data (or in this case the lack of data), it was just the display that looked ugly.

So the first thought was to check puterSoft’s web site to see if this was a known issue and had a fix or work around.  That failed and when I tied to ping the domain name, that failed.  I did some playing around on http://www.dnsstuff.com/ and I learned that it was hosted at DiscountASP.net and that DNS lookups are failing.  If you perform a DNS lookup for puterSoft, it goes into a loop and DNSstuff is smart enough to break out of that loop. 

I can’t tell if puterSoft is gone or something is all fracked up with DiscountAsp.net’s DNS records.  I’ve emailed Sergiy at puterSoft to see if they are still around.  I also fired off an email to DiscountAsp to see if they can tell me anything.  After 20 minutes, I got a reply back from DiscountASP.NET that the account has been cancelled.  That’s Not Goodtm.

Since I’m not going to get any resolution from puterSoft in the immediate future, I decided to take a whack at it and see if it was a simple fix.  And it looks like it is.

When you exit a TPSCDateEdit, the following methods are called:

  • TPSCCustomDateEdit.PostValue
  • TPSCCustomDateEdit.SetDateTime
  • TPSCCustomDateEdit.UpdatePopup
  • TPSCCustomDateEdit.GetAsText

Other methods are called, these are the ones important here.  UpdatePopup has the following logic:

 

If Text <> GetAsText Then
  Text :
= GetAsText;

 

The code in GetAsText looks like this:

 

function TPSCCustomDateEdit.GetAsText:String;
begin
  Result:=DateTimeFormat.ToString(DateTime,Kind)
end
;

</p>

By changing that code to this:

function TPSCCustomDateEdit.GetAsText:String;
begin
  if DateTime <> then
    Result:=DateTimeFormat.ToString(DateTime,Kind)
  else
    result := ;
end;

 

I get result that I want. And life is good again.

Tech Tags: