2 Replies Latest reply on Jun 28, 2010 2:42 PM by TejasJani123

    set "today" on DateChooser control




      I am wondering if there is a way to set the "today" date in DateChooser component. From looking at the source of DateChooser and CalendarLayout controls, "today" is always set to the current date in machine's timezone and it does not seem like I would have any control over setting today's date. I need to be able to set today to a date in a timezone specified in a user-profile, for instance,.


      thanks in advance


        • 1. Re: set "today" on DateChooser control
          BhaskerChari Level 4

          Hi ,


          You can set selected any Date in DateChooser control using the selectedDate property of the DateChooser control...


          As you said its true that "today" is always set to the current date in machine's timezone and you does have a way to control over setting today's date.


          Check out the code below ...you can see that in the setSelectedDate() function I am setting the DateChooser control to date 2nd December 2009...


          You can give any values to the date you want the DateChooser to select...by using the selectedDate property...


          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="setSelectedDate();">


                      private function setSelectedDate():void {
                          dateChooser.selectedDate = new Date(2009,11,02);

              <mx:DateFormatter id="df"/>
              <mx:Panel title="Set Selected Date..." height="75%" width="75%"
                  paddingTop="10" paddingLeft="10" paddingRight="10">
                        <mx:Label text="Simple DateChooser control."/>
                        <mx:DateChooser id="dateChooser" yearNavigationEnabled="true"/>


          Hope this is what you required..

          If this post answers your question or helps, please kindly mark it as such.


          Bhasker Chari

          • 2. Re: set "today" on DateChooser control
            TejasJani123 Level 1

            well, I am aware of the selectedDate property, but "today" is a different propety than selected date, i.e. you can set any value to selectedDate property, where "today" is something which conceptually does not change. Also, if you look at the framework code in DateField, DateChooser and CalendarLayout, there are different styles defined to display today vs selectedDate. I was looking for a simple way to set today (as opposed to selectedDate). Here is a similar question on another forum: http://stackoverflow.com/questions/552950/flex-datechooser-how-to-override-the-today-date