numbers.py have a bug!!

Issue #779 resolved
eson
created an issue
def is_date_format(fmt):
    if fmt is None:
        return False
    fmt = fmt.lower()
    if any([x in fmt for x in DATE_INDICATORS]):
        return not BAD_DATE_RE.search(fmt)
    return False
 if any([x in fmt for x in DATE_INDICATORS]):
        return not BAD_DATE_RE.search(fmt)
that lead to incorrect return

eg: fmt = m"M"d"D";@ (m"月"d"日";@ extract from my excel file)

Comments (9)

  1. CharlieC
    • removed responsible

    Thanks for the report. Unfortunately support for number formats is by definition somewhat limited, not least because some formats are locale specific. The specification even goes so far as to say that but interoperability will only be possible via mutual agreement between implementers.

    To resolve this properly someone would have to implement the microformat as documented in the "implementers notes" part of the documentation. There are currently no plans to do this. As an alternative openpyxl 2.5 will support the datetime cell type which will allow openpyxl to save and read datetimes unambiguously.

  2. Log in to comment