diff --git a/src/pynwb/file.py b/src/pynwb/file.py index 8f7be9fb6..e44d688a2 100644 --- a/src/pynwb/file.py +++ b/src/pynwb/file.py @@ -305,10 +305,12 @@ def __init__(self, **kwargs): raise ValueError("'timestamps_reference_time' must be a timezone-aware datetime object.") self.fields['file_create_date'] = getargs('file_create_date', kwargs) + if self.fields['file_create_date'] is None: - self.fields['file_create_date'] = datetime.now(tzlocal()) - if isinstance(self.fields['file_create_date'], datetime): + self.fields['file_create_date'] = [datetime.now(tzlocal())] + elif isinstance(self.fields['file_create_date'], datetime): self.fields['file_create_date'] = [self.fields['file_create_date']] + self.fields['file_create_date'] = list(map(_add_missing_timezone, self.fields['file_create_date'])) fieldnames = [