Opened 9 years ago

Last modified 6 years ago

#888 new enhancement

"is-date" should return "true" only if date parses cleanly — at Version 2

Reported by: erazlogo Owned by: simon
Priority: major Milestone:
Component: styles Version: 1.5
Keywords: Cc: bdarcus, simon, fbennett

Description (last modified by dstillman)

right now "is-date" seems to return "true" if the field can be parsed into a valid date (regardless of what else it contains), which leads to the following loss of data when moving from the Zotero date field to CSL:

"1750-1754" > "1750";
"[2000?]" > "2000";
"ca. 2000" > "ca 2000";
"n.d." > "n.d"

All of the above should probably evaluate as "false" and just return the whole string.

Change History (2)

comment:1 Changed 9 years ago by erazlogo

  • Description modified (diff)

comment:2 Changed 9 years ago by dstillman

  • Description modified (diff)
  • Summary changed from "is-date" should return "true" only if it's a date with nothing in "parts" to "is-date" should return "true" only if date parses cleanly

Actually I guess it's a bit more difficult than checking if "part" is empty, since "[2000?]" parses to { year: 2000, part: undefined }... So parsed numbers might need to be rechecked in their original context to make sure there are no other characters.

Elena, are there other examples that you can think of that might fail at something like this?

Note: See TracTickets for help on using tickets.