I'm totally not getting this.

I'm trying to introduce a split of a time block to end at midnight local.
If the stop time is less than the start time, I clone the row, and set the stop time of the original row to midnight, and the start time of the clone to midnight.

Problem is:
Code:
Compatibility OFF

if ( ! NextDay )
{
    var tempStop=str2date("1970-01-01 00:00:00","yyyy-MM-dd HH:mm:ss")
    stop.setValue(tempStop)
    var minutes=(dateDiff(strt,tempStop,"mi")+1440)
} else {
    var tempStrt=str2date("1970-01-01 00:00:00","yyyy-MM-dd HH:mm:ss")
    var tempExcDate=dateAdd(excDate,"d",1)
    strt.setValue(tempStrt)
    excDate.setValue(tempExcDate)
    var minutes=dateDiff(tempStrt,stop,"mi")
}
Fails with Javascript error:
2009/07/16 09:59:11 - Split Midnight & Calc Minutes.0 - ERROR (version 3.1.0, build 826 from 2008/09/30 11:32:36) : TypeError: Cannot find function setValue in object Thu Jan 01 23:00:00 PST 1970. (script#11)


But...

Code:
Compatibility *ON*

if ( ! NextDay.getBoolean() )
{
    var tempStop=str2date("1970-01-01 00:00:00","yyyy-MM-dd HH:mm:ss")
    stop.setValue(tempStop)
    var minutes=(dateDiff(strt.getDate(),tempStop,"mi")+1440)
} else {
    var tempStrt=str2date("1970-01-01 00:00:00","yyyy-MM-dd HH:mm:ss")
    var tempExcDate=dateAdd(excDate.getDate(),"d",1)
    strt.setValue(tempStrt)
    excDate.setValue(tempExcDate)
    var minutes=dateDiff(tempStrt,stop.getDate(),"mi")
}
Works.

If I try to use the "create and replace" method in the Javascript step, all my variables need to be set on both sides of the ELSE (ie. if I use tempStrt and declare the replace in the bottom part of the step, it needs to be set on both the true and false sides of the ELSE)


Am I missing something simple?