Date class: ambiguous dates cause unexpected results

Issue #46 resolved
Hans van der Weij created an issue

1-6-2011: Invalid date format

1.6.2011: OK

In Europe the dash - separator is probably more common than period. I'm not sure about usage of slash /

Comments (3)

  1. Hans van der Weij reporter
    • changed version to tip
    • changed milestone to 0.7

    After implementing the fix for #29, this becomes a different issue

    I've fixed this too, changeset linked at the bottom. It's a very simple code change, but in human language I need a lot of words to describe what's wrong and how to change that.

    Example: I want to use Override Due Date to set Due Date to July 1st 2011 (library closes for the summer, all books have to be returned). Being a Dutchman, I would enter 1-7-2011 in the Due Date field, but the resulting internal format (yyyy-mm-dd) is 2011-01-07, Januari 7th 2011. This is easily ignored, causing an unjust late fee on check in. All this trouble just before my well earned holiday? I'm sure you can understand I have strong objections about that.

    I have to admit that before this week I didn't really understand that OpenBiblio tries to understand date formats. After analyzing the date class and reading long (mostly Wikipedia) articles about date formats I see:

    • OpenBiblio understands yyyy-mm-dd (ISO 8601) automatically - no problems, not ambiguous.
    • Use of dash separator in the United States is quite common - well OK: than it's not unique for European date styles.
    • Dot separator ( is very common in and around Europe and probably not ambiguous - Oh no... just after I wrote this, the OpenBiblio header smiles at me and says: mm.dd.yyyy

    I agree with the intention expressed in the date class: OpenBiblio should understand automatically, this format should not be ambiguous. So I will propose a change for the header. Americans, please: leave the dots for us Europeans.

    • Date formats separated by dash and slash are ambiguous. I've seen code examples that automatically understand a slash separator as American and dash as European. I don't think that's really universal. The OpenBiblio date class acts on a single entry field, there is no information for the user about the formats that it understands. Therefore, I think the only solution is that ambiguous dates aren't interpreted automatically and that OpenBiblio tells the user how to use an unambiguous format. It's only a small change in the code; if day > 12 not a month.

    Thanks Micah, looks like you already wrote it to become universal.


  2. Log in to comment