11 Replies Latest reply on Aug 19, 2006 10:14 AM by Halcyoncollective.com

    Problem with comparing selectedDate from Calendar to dates in XML file


      I'm trying to build a calendar where a user can click on a date, and then a textbox will display the name of an event on that date. The data is located in an XML file, but for now I will be contend if I can get a hard coded date to work. The name of the DateChooser is rssCal. I hardcoded today's date into a variable called nextDay, and then I said that if the selectedDate equals nextDay, print true, otherwise, print the selectedDate. The problem is that when I select today, I don't get true, I get Thu Aug 17 00:00:00 GMT-0400 2006, which is the exact value I entered into nextDay. If anyone can help me out, I would appreciate it. My code is as follows:

      public function displayInfo():void {
      var nextDay:Date = new Date("Thu Aug 17 00:00:00 GMT-0400 2006");
      if (rssCal.selectedDate == nextDay) {
      box1.text = "True";
      } else {
      box1.text = String(rssCal.selectedDate);