How to show day before for date

What is the script to display date, one day before today(current date), for Date Range component?
for example I have this:
import datetime
date_component = system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Date Range’).startDate
date_component = datetime.date.today() - datetime.timedelta(1)

does not seem to have an effect .

Thanks

You could bind the following code to the End Date

This will run once when window is opened.

now(0)

Then bind this code to the Start Date

dateArithmetic(now(0), -1, "day")

Cheers,
Chris

but thats for expression binding, what about script i can place in internal frame activated?

You can use java’s Calendar to work with dates in scripting

[code]from java.util import Calendar

#get current time
endDate = Calendar.getInstance()

#add 1 day to endDate
endDate.add(Calendar.DATE, 1)

event.source.parent.getComponent(‘Date Range’).endDate = endDate.getTime()[/code]

Pat’s suggestion would be the only way to do this via scripting. I think the OP had also emailed in on this. The expression binding route would be the best method of doing what you want to do. If you set the polling time for now() to 0, such as now(0), it will only poll once when the window opens and that is all. With that being said, the first reply would be the best way to achieve what you are after.