provide a default value for $duration - 86400 (1 day) should work.