实现日期比较
public function next(event:MouseEvent):void{
var date:Date= DateFormatter.parseDateString(showDate);
date.setDate(date.date+1);
showDate=AFCDate.parseCurrentCalendar(date).substring(0,10);
timeLabel.text=showDate;
//判断(下一天)时间不能大于结束时间
resetButton();
if(parentUI.scheduleMap.hasKey(showDate)){
documentDG.dataProvider=parentUI.scheduleMap.itemFor(showDate) as ArrayCollection;
}
}
public function preDay(event:MouseEvent):void{
var date:Date= DateFormatter.parseDateString(showDate);
date.setDate(date.date-1);
showDate=AFCDate.parseCurrentCalendar(date).substring(0,10);
timeLabel.text=showDate;
//判断(上一天)时间不能小于开始时间
resetButton();
if(parentUI.scheduleMap.hasKey(showDate)){
documentDG.dataProvider=parentUI.scheduleMap.itemFor(showDate) as ArrayCollection;
}
}
private function resetButton():void{
var showDay:String=showDate.toString();
var startDay:String=parentUI.startDate.value.toString().substring(0,10);
var endDay:String=parentUI.endDate.value.toString().substring(0,10);
var myPattern:RegExp=/-|:| /g;
showDay=showDay.replace(myPattern,'');
startDay=startDay.replace(myPattern,'');
endDay=endDay.replace(myPattern, '');
if(Number(showDay)>=Number(endDay)){
nextButton.enabled=false;
}else{
nextButton.enabled=true;
}
if(Number(showDay)<=Number(startDay)){
preDayButton.enabled=false;
}else{
preDayButton.enabled=true;
}
}