0 Replies Latest reply on Jul 30, 2007 9:57 AM by darrylfrith

    date range

      I found this piece of code that selects the entire week when a user clicks on a day in the dateChooser. I would like to create the same function that would select the entire month that would be triggered by a radio.


      // select week

      public function selectWeek(calendar :DateChooser) :void
      var sd:Date = calendar.selectedDate
      var dayUTC:Number = 86400000;
      // check if sunday (first day of civil week)
      var sd_sun:Date = sd;
      if (sd.day != 0)
      sd_sun = new Date(sd.valueOf() - sd.day * dayUTC);
      var sd_sat:Date = new Date(sd_sun.valueOf() + 6 * dayUTC);
      calendar.selectedRanges = [{rangeStart: sd_sun, rangeEnd: sd_sat}];


      The other problem I have is getting the actual dates from this. I am passing the selected date like this to my http request:

      private function updateRange():void

      var df:DateFormatter = new DateFormatter();
      df.formatString = "YYYY-MM-DD";
      var formattedDate:String = df.format(chooser.selectedDate);

      get_pageloads.url = " http://www.mydomain.com/flex_data/flex_data.php?p=" + formattedDate;

      but I don't know how to send the starting and ending date when using the selected week function. I would like to send the starting date and ending date in the http request in the same date format as the SelectedDate scenario above.

      Any suggestions?