Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for dates before 1900 #93

Closed
peterisb opened this issue Jun 12, 2014 · 2 comments
Closed

No support for dates before 1900 #93

peterisb opened this issue Jun 12, 2014 · 2 comments
Labels
stale Stale bot

Comments

@peterisb
Copy link
Contributor

Django Version: 1.6.5
Exception Type: ValueError
Exception Value:
year=1899 is before 1900; the datetime strftime() methods require year >= 1900
Exception Location: /usr/local/lib/python2.7/dist-packages/import_export/widgets.py in render, line 92
Python Executable: /usr/bin/python
Python Version: 2.7.3

Some years ago fixed in django https://code.djangoproject.com/ticket/1443

@andybak
Copy link

andybak commented Aug 17, 2014

I think you just need to copy the same fix from #94 but change date to datetime:

def render(self, value):
    try:
        return value.strftime(self.format)
    except:
        return datetime_safe.new_datetime(value).strftime(self.format)

ajparsons added a commit to ajparsons/django-import-export that referenced this issue Jul 9, 2016
Applying fix from django-import-export#94 (DateWidget) to issue django-import-export#93 (same thing but for DateTimeWidget) - use datetime_safe to export pre-1900 dates without errors.
@stale
Copy link

stale bot commented Feb 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale bot label Feb 11, 2019
@stale stale bot closed this as completed Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale bot
Projects
None yet
Development

No branches or pull requests

2 participants