added optional passing of a date to date function