Added null checks for the context on date formatting

Added null checks for the context on date formatting.