Skip to content

Why are we doing second -> date conversion our selves? #2845

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

Closed
tacaswell opened this issue Feb 26, 2014 · 4 comments
Closed

Why are we doing second -> date conversion our selves? #2845

tacaswell opened this issue Feb 26, 2014 · 4 comments

Comments

@tacaswell
Copy link
Member

See ~L350 in matplotlib.dates.py in strftime. Without delving too deep, I think this should be handled by datetime.

@tacaswell
Copy link
Member Author

This should probably be dealt with while fixing #2294.

@tacaswell tacaswell added this to the v1.4.x milestone Mar 3, 2014
@tacaswell tacaswell modified the milestones: v1.5.x, v1.4.x Nov 26, 2014
@pganssle
Copy link
Member

I'm not seeing exactly what you are talking about with this. Has it already been fixed?

L350 of matplotlib.dates.py is an indirect call to L217, which I think just deals with ordinal floats and uses datetime pretty extensively.

strftime in the current version is L434-L466, but I don't see anything obviously wrong with it.

@tacaswell
Copy link
Member Author

I no longer remember what prompted me to create this issue.

I think it boils down to the fact that we have all manner of logic for converting dates <-> scalars that should be handled by an external library.

Closing this as the fix is probably a complete overhaul of dates which is sort of already on the radar.

@pganssle
Copy link
Member

Well with regards to the question of strftime, I think the problem is that as far as I can tell there's nothing in the standard library that will work for dates < 1900 AD. A fix has apparently been implemented in 3.x, but is still limited to dates > 1000 AD. In my opinion, it's probably better to leave that code as is if it's working rather than add any additional dependencies.

The main other place that I see a problem is in the functions which call _from_ordinalf and _to_ordinalf, which gets the Gregorian days from datetime, then has its own method for converting fractional days into hours, minutes, seconds, etc. Again it seems like there's no library function that converts a fractional day into a timedelta, and the way it's done in dates.py is standard. See Issue 12772. Actually, I think I found a way to do this. See PR #3947.

@pganssle pganssle mentioned this issue Dec 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants