Skip to main content
Participant
May 10, 2006
Answered

date field

  • May 10, 2006
  • 2 replies
  • 368 views
Hi all!

I'm using the date field with a dynamic generated date. Look at the code:

var today_date:Date = new Date();
begin.selectableRange = {rangeStart: today_date};

Well this is working fine, but the problem is that it's including the day of Today. Is there any way to tell it to start with yesterday instead?

Thx in advance.

mw
This topic has been closed for replies.
Correct answer
var today_date:Date = new Date();

today_date.setDate(today_date.getDate()-2)

begin.selectableRange = {rangeStart: today_date};

Hakan K.
www.FlashDersi.com

2 replies

Participant
May 11, 2006
Thank you very much for your reply!

I just made some modifications in your code:

var today_date ate = new Date();

var yesterday = today_date.setDate(today_date.getDate()-1);

begin.selectableRange = {rangeStart: new Date(yesterday)};

Now you can still choose the date of Today but all dates before today are disabled. Just what I was looking for.

Thanks again for your reply.

san sasuke
Participant
May 11, 2006
Please...any help is welcome.
Correct answer
May 11, 2006
var today_date:Date = new Date();

today_date.setDate(today_date.getDate()-2)

begin.selectableRange = {rangeStart: today_date};

Hakan K.
www.FlashDersi.com