Skip to content

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

Closed

Description

@tacaswell

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

Activity

  1. tacaswell commented on Feb 26, 2014

    @tacaswell
    MemberAuthor

    This should probably be dealt with while fixing #2294.

  2. added this to the v1.4.x milestone on Mar 3, 2014
  3. modified the milestones: , v1.4.x on Nov 26, 2014
  4. pganssle commented on Dec 24, 2014

    @pganssle
    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.

  5. tacaswell commented on Dec 24, 2014

    @tacaswell
    MemberAuthor

    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.

  6. pganssle commented on Dec 24, 2014

    @pganssle
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions