DateTime Input and Project Library script error

If I call my project library script def shiftGenerator(startDate, shiftPattern): from the Script Console like this,

	startDate =, -1)	# Yesterday for testing.
	shiftPattern = [ ... ]
	shiftCalcs.shiftCalcs.shiftGenerator(startDate, shiftPattern)

it works.

When I call it from an Expression Binding like this,

	2000,	// 2 second update for testing. 

The problem seems to be caused by whatever format the datePicker session variable is stored in. datePicker is generated by a DateTime Input component which has a simple (bidirectional) property binding from it’s props.value to the session custom property session.custom.datePicker.

It seems to choke with an Error_ExpressionEval error when startDate is passed to this function:

def addShiftStartTime(timestamp, time_str, nextDay):
	# First shift usually starts at 7 a.m. or 8 a.m.
	# timestamp is midnight of the calendar start day.
	# time_str is the shift start in "hh:mm" format.
	# nextDay signals if the start of the third shift is after midnight.
	h, m = time_str.split(':')
	newDate =, int(h))	# Add on the hours,
	newDate =, int(m))	# and the minutes,
	if nextDay:											
		newDate =, 1)		# and another 24 hours.
	return newDate

Can anyone suggest some debug procedures?

Some progress. Changing
d =
d =
in my function seems to work for both the Script Console and the Expression Binding.