Skip to content

Parsing date with mixed slashes and Chinese time of day #808

Closed

Description

@wesinator

similar to #232

datestring 2020/10/9 下午 02:26:26 is used in zh-CN language HFS servers
Other example: https://twitter.com/healthyscc/status/1299582251101949952

import dateparser

d = dateparser.parse("2020/10/9 下午 02:26:26")
print(d)

returns None

expect: datetime object

Thanks for the work on this library and making it open source

Activity

  1. added
    Type: Bug - Language
    on Oct 11, 2020
  2. noviluni commented on Apr 12, 2021

    @noviluni
    Contributor

    I checked this and I saw that we already support 下午 (pm) and 上午 (am).

    However, dateparser expects to find it after the hours. Working examples:

    >>> dateparser.parse("2020/10/9 02:26:26 下午")
    datetime.datetime(2020, 10, 9, 14, 26, 26)
    
    >>> dateparser.parse("2020/10/9 02:26:26 上午")
    datetime.datetime(2020, 10, 9, 2, 26, 26)

    The " 下午 " format is correctly converted to "[day] pm [hour]", however, this format it's not working because as I mentioned dateparser expects to find the am, pm after the hour and not before. We should see which workaround should we do here to implement a solution for this.

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

    Type: Bug - Language

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions