Fixing memory leak in date and time directives