In my basic Flex application I have a few layers that are displayed and refreshed at 20second intervals. The application is designed to be shown on display screen to give users a sitrep. One of my layers is a feature layer that is time aware. It is set up in snapshot mode. A complication is - that for purposes of this app ??? the day runs from 0400 to 0400 NOT midnight to midnight. So...... In my init function- I have in order to refresh this layer every 20 seconds. setInterval(queryPublishedTraceLayer, 20000);
The queryPublishedTraceLayer function is: //for the published traces we need to only get todays. Day runs from 4am to 4am
private function queryPublishedTraceLayer():void
{
//get correct date and times first
setDates();
//set time extent for the published traces layer (NB layer mode must be snapshot for this to work).
publishedTracesLayer.timeDefinition = timeExt;
//refresh published traces layer.
publishedTracesLayer.refresh();
}
The function that sets up the dates is: private function setDates():void
{
//check the date time if time is less than 0400 then "todays date" is actually yesterday as Range times run from 0400 to 0400
var dateNow:Date = new Date();
var todayStart:Date = new Date();
if (dateNow.hours < 4)
{
//If the current time is between 00:00 and 04:00 then "todays date" - in range terms - is technically yesterdays date
// as 24 hour period on range runs from 0400-0400. Set todayStart to be yesterdays date
todayStart.date = dateNow.date -1;
}
//todays date for display is today @ 0400 until tomorrow at 0400 so set times
todayStart.hours = 4;
todayStart.minutes = 0;
todayStart.seconds = 0;
todayStart.milliseconds = 0;
//set todays end date - which is actually tomorrow at 0400.
var todayEnd:Date = new Date(todayStart.fullYear, todayStart.month, todayStart.date + 1, 4,0,0,0);
//set time extents
timeExt.startTime = todayStart;
timeExt.endTime = todayEnd;
//destroy date objects
dateNow = null;
todayStart = null;
todayEnd = null;
}
Time ext is set up at application level:private var timeExt:TimeExtent = new TimeExtent();
When debugging, the output for timext is as follows:endTime <Wed Aug 28 04:00:00 GMT+0100 2013> (@e05cf01) startTime <Tue Aug 27 04:00:00 GMT+0100 2013> (@e05cf21) I have saved some test features in my feature class and all are displaying as expected EXCEPT one, which has it's end date set to 27th August 03:59:00. Based on the fact I have set the times up so that "today" starts at 0400 and ends tomorrow at 0400, I would not expect this feature to show in the display. Can anyone point me in the direction of what I may have done wrong, to cause this feature to display when I don't want it to?Hope this makes sense and someone can help.