Menu

change 'year' type

roberto
2012-09-12
2013-05-28
  • roberto

    roberto - 2012-09-12

    Hy all
    I'd like to store year information as varchar instead as smallint, I've changed the value in DB in refs/year but it seems to be not enough.
    The reason is because I'd like to store also values different than integer, inserting typical cataloguing informations (different from citation formats) like '' or '.
    The page 'record.php' holds in filed 'yearNo' the desired value, if I write something different than simply numbers, the system automatically resets the entered data writing 0 to the DB….
    Do you think it's possible to work on php code in order to let the system store varchar values in that field?
    best regards
    RM

     
  • Matthias Steffens

    Hi robmor,

    we've discussed converting the year field to varchar previously (among developers). This is something we'd also like to see.

    IIRC, we agreed on opening up the year field to (among other things) allow for month and day info (which would need to be entered in a structured way, though), then use some text parsing to extract the individual bits. The successfully parsed date elements could be saved to a new SQL field of type 'date' (e.g. named 'publication_date'), and this field could be then used for sorting. This would be similar to what we do with the 'volume' and 'volume_numeric' fields, and would give flexibility while avoiding to clutter the interface further more.

    We thought about adopting the W3C profile of the ISO 8601 format (YYYY-MM-DD), or even better, maybe adopt the "Extended Date/Time Format (EDTF)" initiative by the Library of Congress which allows (among other things) for uncertain dates (e.g. 1992?), approximate dates (e.g. 1992~), incomplete dates with unspecified parts (e.g. 199u), and date ranges (e.g. 1994/1996 or 2004-03-01/2005-02).

    http://www.loc.gov/standards/datetime/index.html

    Unfortunately, nothing has been done about this yet and I cannot give you a time frame when this will get changed. However, I've moved this issue to the group of top items on my TODO list.

    I'd like to store also values different than integer, inserting typical cataloguing informations (different from citation formats) like '' or '.

    Do the date strings '' and ' have a specific meaning? And could these be converted into a syntax that is compatible with the above linked EDTF spec? In other words, would a date formatting that is compatible with the EDTF spec work for you? If so, would you require any of the EDTF "Level 2" features?

    Thanks, Matthias

     
  • roberto

    roberto - 2012-09-12

    Hi Matthias
    EDTF spec works fine.
    corresponds to uncertain values
    best regards
    RM

     

Log in to post a comment.