Skip to content

Clarify exception for unknown standard patterns to point to % #971

Description

@malcolmr

It is somewhat unexpected that a custom pattern of (e.g.) "HH" will work fine, but a custom pattern of "H" will throw an error (see e.g. #928), and needs to be specified as "%H" instead.

We do document this in the user guide (http://nodatime.org/userguide/text, "Standard and custom patterns"), but it's a bit hidden.

It would be nice if the exception text ("The standard format "x" is not valid for the NodaTime.ZonedDateTime type.") explicitly mentioned the possibility of escaping a custom pattern.

(Perhaps it could do so conditionally based on whether %x was a valid custom format pattern; doing that is trivial, apart from the case of InstantPatternParser.)

Activity

  1. added this to the 2.2.1 milestone on Sep 15, 2017
  2. added a commit that references this issue on Oct 11, 2017
    c831e05
  3. added 4 commits that reference this issue on Oct 11, 2017
    33c5f4a
    cabb2b5
    52dbd61
    00fed9a
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