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

dates should be supported that are before christ was born (Ie. negative dates!) #114

Open
TMeerhof opened this issue Jun 24, 2015 · 1 comment

Comments

@TMeerhof
Copy link

because there will be archeological data in the API, we should support dates BC.
Python datatime has no support for these dates.

@breyten breyten changed the title get ready for dated BC dates should be supported that are before christ was born (Ie. negative dates!) Jun 24, 2015
@breyten
Copy link
Member

breyten commented Jun 24, 2015

I toyed a little with this:

import datetime

class DateBC(datetime.date):
    bc = False
    def __str__(self):
        prefix = '-' if self.bc else ''
        return u'%s%s' % (prefix, super(DateDC, self).__str__(),)

Which works if you set the bc attribute to True. Modifying isoformat() would probably work the same way and then all we need to know is if these negative dates are supported by Elasticsearch.

We can do this trick because we're not calculating with dates anyway.

(I'll check for Elasticsearch support)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants