Issue #420 resolved
Bors LTD created an issue

Hi, in openpyxl/styles/


Is there a reason the constant is called with a four-digit year but the actual format will use a two-digit year? It seems misleading to me.

But maybe the issue is with Excel?

Comments (4)

  1. CharlieC

    I think we copied it over from existing code like that. I agree it's misleading but I never use the constant names myself here. US_date would probably be better.

    Feel free to submit a PR with improvements.

  2. Bors LTD reporter

    I'm curious how you do that. What we want is using French date formats globally (dd/mm/yyyy).

  3. CharlieC

    I don't think there's a built-in for that. :-/ To make matters worse some formats are client locale specific.

    We've essentially standardised on ISO for Python datetimes (search for bug on this) and this is a custom format. If you know what you're doing you will be able to hack that in 2.2 just before you save a file by overwriting the relevant value un wb._number_formats.

    I'm hoping to add support for named styles in a future version. This may, hopefully, allow you to work with a standard format where you could simply define the number format for the default named styles once. NB. it would still be a custom format! Named styles are available in those pulldowns. Absurdly, the localised names get stored in the files if the definitions get edited. Waiting for clarification on this before doing any more work.

  4. Log in to comment