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

[enhancement] support ISO8601 offsets #58

Closed
kevinburke opened this issue Aug 13, 2014 · 3 comments
Closed

[enhancement] support ISO8601 offsets #58

kevinburke opened this issue Aug 13, 2014 · 3 comments

Comments

@kevinburke
Copy link
Contributor

For example, if I type date --iso-8601=seconds using the GNU date program, I get the output

2014-08-13T16:46:08-0700

It would be nice if this was parsed properly into a Time object, instead the code generates:

Near line 4, key 'date': Near line 4: Expected 'Z' in ISO8601 datetime, but found '-' instead.

Here's the relevant piece of code:

func lexDateAfterYear(lx *lexer) stateFn {
    formats := []rune{
        // digits are '0'.
        // everything else is direct equality.
        '0', '0', '-', '0', '0',
        'T',
        '0', '0', ':', '0', '0', ':', '0', '0',
        'Z',
    }
    for _, f := range formats {
        r := lx.next()
        if f == '0' {
            if !isDigit(r) {
                return lx.errorf("Expected digit in ISO8601 datetime, "+
                    "but found %q instead.", r)
            }
        } else if f != r {
            return lx.errorf("Expected %q in ISO8601 datetime, "+
                "but found %q instead.", f, r)
        }
    }
    lx.emit(itemDatetime)
    return lx.pop()
}
@kevinburke kevinburke changed the title support ISO8601 offsets [enhancement] support ISO8601 offsets Aug 13, 2014
@BurntSushi
Copy link
Owner

Since this project maintains parity with the TOML spec, it isn't really appropriate to post specification changes here. In fact, this feature should hopefully get merged soon.

So I'll leave this issue open for now. It will likely be implemented eventually.

@kevinburke
Copy link
Contributor Author

ah, whoops, didn't realize this was defined in the upstream spec.

Kevin Burke
phone: 925.271.7005 | kev.inburke.com

On Wed, Aug 13, 2014 at 5:26 PM, Andrew Gallant [email protected]
wrote:

Since this project maintains parity with the TOML spec, it isn't really
appropriate to post specification changes here. In fact, this feature
toml-lang/toml#189 should hopefully get merged
soon.

So I'll leave this issue open for now. It will likely be implemented
eventually.


Reply to this email directly or view it on GitHub
#58 (comment).

@cespare
Copy link
Collaborator

cespare commented Feb 23, 2016

Closing this issue in favor of #96.

@cespare cespare closed this as completed Feb 23, 2016
ebrady pushed a commit to dvln/toml that referenced this issue Oct 24, 2016
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

3 participants