Skip to content

[Discussion] TimestampParser strictly mode. #17

Open
@hiroyuki-sato

Description

@hiroyuki-sato

For future discussion.

Current TimeStampParser allows parsing as timestamp the following data.

  • format: %Y-%m-%d %H:%M:%S.
  • input data: 2015-01-27 19:23:49 aaa(aaa is non-time data)

Some users want to use TimestampParser strictly.
It is mean that a user wants to error when above data parsed.

JRuby behavior

[1] pry(main)> Date._strptime("2017/05/22 23:12:34","%Y/%m/%d %H:%M:%S")
=> {:year=>2017, :mon=>5, :mday=>22, :hour=>23, :min=>12, :sec=>34}
[2] pry(main)> Date._strptime("2017/05/22 23:12:34 hogehogehoge","%Y/%m/%d %H:%M:%S")

=> {:year=>2017,
 :mon=>5,
 :mday=>22,
 :hour=>23,
 :min=>12,
 :sec=>34,
 :leftover=>" hogehogehoge"}

Ref(Written in Japanese)

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