Skip to content

intervalstyle support #9

Closed
Closed

Description

@elmigranto

Support for non-default intervalstyles is missing. I don't think this is something many people are using, but worth to at least mention it in the docs.

set intervalstyle to default; -- default being `postgres`;
select '1 day'::interval;
-- PostgresInterval { days: 1 }
set intervalstyle to 'iso_8601';
select '1 day'::interval;
-- PostgresInterval {}

Activity

  1. bendrucker commented on Jul 20, 2016

    @bendrucker
    Owner

    Hmm, I think the right move here is to throw when one of these styles is detected until the library supports them. I found plenty of prior work on the 8601 duration format so I could probably steal some regexes and built a proper micro lib with tests:

    https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=iso%208601%20interval%20parser

  2. elmigranto commented on Jul 20, 2016

    @elmigranto
    ContributorAuthor

    Sure. ISO one is pretty straight forward, but postgres_verbose has a lot of caveats, like displaying negative values with ago (e.g. 1 year ago for -1 year).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions