<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Setting selectable ranges in the Flex DateField control</title>
	<atom:link href="http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 19:26:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tahir Alvi</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-10216</link>
		<dc:creator>Tahir Alvi</dc:creator>
		<pubDate>Thu, 01 Dec 2011 16:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-10216</guid>
		<description>Hi,

If i want to enable only working days in calendars, then how i do that?

Thanks</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>If i want to enable only working days in calendars, then how i do that?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: naidu</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-9298</link>
		<dc:creator>naidu</dc:creator>
		<pubDate>Mon, 13 Jun 2011 20:05:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-9298</guid>
		<description>nice one. what if i want to display for one month time stamp(taking the latest date(coming from database) as end date ). it should be dynamic.</description>
		<content:encoded><![CDATA[<p>nice one. what if i want to display for one month time stamp(taking the latest date(coming from database) as end date ). it should be dynamic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-8144</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 17:06:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-8144</guid>
		<description>@Michael Liscio,

Great tip, thanks! Also, you can probably do something similar to the following:
&lt;pre lang=&quot;mxml&quot;&gt;

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; initialize=&quot;init();&quot;&gt;
    
    &lt;mx:Script&gt;
        &lt;![CDATA[
            protected function init():void {
                var endDate:Date = new Date();
                var startDate:Date = new Date(endDate.time);
                startDate.date -= 30;
                
                sDateLbl.text = &quot;start date: &quot; + startDate.toDateString();
                eDateLbl.text = &quot;end date: &quot; + endDate.toDateString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;
    
    &lt;mx:Label id=&quot;sDateLbl&quot; /&gt;
    &lt;mx:Label id=&quot;eDateLbl&quot; /&gt;
    
&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>@Michael Liscio,</p>
<p>Great tip, thanks! Also, you can probably do something similar to the following:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">&nbsp;
<span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            protected function init():void {</span>
<span style="color: #339933;">                var endDate:Date = new Date();</span>
<span style="color: #339933;">                var startDate:Date = new Date(endDate.time);</span>
<span style="color: #339933;">                startDate.date -= 30;</span>
&nbsp;
<span style="color: #339933;">                sDateLbl.text = &quot;start date: &quot; + startDate.toDateString();</span>
<span style="color: #339933;">                eDateLbl.text = &quot;end date: &quot; + endDate.toDateString();</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;sDateLbl&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;eDateLbl&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Liscio</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-8142</link>
		<dc:creator>Michael Liscio</dc:creator>
		<pubDate>Wed, 21 Jul 2010 15:12:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-8142</guid>
		<description>This is an excellent example.  However I notice one situation that is not covered here that I recently had to hanle in my code.  
What if you want users to be only able to select dates within the last x amount of days in my case 60.  You can&#039;t set the start date to a specific date sense the start date will increase by 1 each day.  In that case the following code will work

selectableRange=&quot;{{rangeStart:new Date(new Date().getTime() - 5184000000), rangeEnd:new Date()}}&quot;

notice the use of the getTime method in the start date means that you have to know how many miliseconds have passed in the past x days 
x * 24(60(60(1000)))
where x is the number of days you are looking for</description>
		<content:encoded><![CDATA[<p>This is an excellent example.  However I notice one situation that is not covered here that I recently had to hanle in my code.<br />
What if you want users to be only able to select dates within the last x amount of days in my case 60.  You can&#8217;t set the start date to a specific date sense the start date will increase by 1 each day.  In that case the following code will work</p>
<p>selectableRange=&#8221;{{rangeStart:new Date(new Date().getTime() &#8211; 5184000000), rangeEnd:new Date()}}&#8221;</p>
<p>notice the use of the getTime method in the start date means that you have to know how many miliseconds have passed in the past x days<br />
x * 24(60(60(1000)))<br />
where x is the number of days you are looking for</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andi</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-7222</link>
		<dc:creator>Andi</dc:creator>
		<pubDate>Thu, 11 Mar 2010 10:19:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-7222</guid>
		<description>Thanks!!!!!!  It’s very helpfull!</description>
		<content:encoded><![CDATA[<p>Thanks!!!!!!  It’s very helpfull!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gunjan kumar</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-6035</link>
		<dc:creator>Gunjan kumar</dc:creator>
		<pubDate>Fri, 16 Oct 2009 17:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-6035</guid>
		<description>It’s helpfull.
Thanks Peter</description>
		<content:encoded><![CDATA[<p>It’s helpfull.<br />
Thanks Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pargat</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-5424</link>
		<dc:creator>Pargat</dc:creator>
		<pubDate>Fri, 28 Aug 2009 13:52:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-5424</guid>
		<description>Thanks Peter. Great post.</description>
		<content:encoded><![CDATA[<p>Thanks Peter. Great post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-2130</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Fri, 23 May 2008 17:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-2130</guid>
		<description>Okay, I figured out how to assign a selectableRange that isn&#039;t hard coded to a DateField that is used as an itemRenderer.  The key piece I was missing was to use outerDocument to reference the object that would be used as the range:
&lt;pre class=&quot;code&quot;&gt;
&lt;mx:Script&gt;
&lt;![CDATA[
private var dateRange:Object = new Object();
dateRange[&quot;rangeStart&quot;] = startDate;
dateRange[&quot;rangeEnd&quot;] = endDate;
]]&gt;
&lt;/mx:Script&gt;

...

&lt;mx:DataGrid&gt;
  &lt;mx:columns&gt;
    &lt;mx:DataGridColumn&gt;
      &lt;mx:itemRenderer&gt;
        &lt;mx:Component&gt;
          &lt;mx:DateField selectableRange=&quot;{outerDocument.dateRange}&quot; /&gt;
        &lt;/mx:Component&gt;
      &lt;/mx:itemRenderer&gt;
    &lt;/mx:DataGridColumn&gt;
  &lt;/mx:columns&gt;
&lt;/mx:DataGrid&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Okay, I figured out how to assign a selectableRange that isn&#8217;t hard coded to a DateField that is used as an itemRenderer.  The key piece I was missing was to use outerDocument to reference the object that would be used as the range:</p>
<pre class="code">
&lt;mx:Script&gt;
&lt;![CDATA[
private var dateRange:Object = new Object();
dateRange["rangeStart"] = startDate;
dateRange["rangeEnd"] = endDate;
]]&gt;
&lt;/mx:Script&gt;

...

&lt;mx:DataGrid&gt;
  &lt;mx:columns&gt;
    &lt;mx:DataGridColumn&gt;
      &lt;mx:itemRenderer&gt;
        &lt;mx:Component&gt;
          &lt;mx:DateField selectableRange="{outerDocument.dateRange}" /&gt;
        &lt;/mx:Component&gt;
      &lt;/mx:itemRenderer&gt;
    &lt;/mx:DataGridColumn&gt;
  &lt;/mx:columns&gt;
&lt;/mx:DataGrid&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-2132</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 21 May 2008 20:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-2132</guid>
		<description>Is there a way to dynamically assign the rangeStart and rangeEnd?  For instance, I&#039;m using the DateField as the itemEditor in a DataGridColumn, and I need to be able to assign a selectableRange  that isn&#039;t hard coded.</description>
		<content:encoded><![CDATA[<p>Is there a way to dynamically assign the rangeStart and rangeEnd?  For instance, I&#8217;m using the DateField as the itemEditor in a DataGridColumn, and I need to be able to assign a selectableRange  that isn&#8217;t hard coded.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: News</title>
		<link>http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/comment-page-1/#comment-2131</link>
		<dc:creator>News</dc:creator>
		<pubDate>Sun, 06 Apr 2008 06:42:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/17/setting-selectable-ranges-in-the-flex-datefield-control/#comment-2131</guid>
		<description>peterd - It&#039;s helpfull, thanks</description>
		<content:encoded><![CDATA[<p>peterd &#8211; It&#8217;s helpfull, thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

