Bibtex (bibdesk) import preserve 'Date-Modified' and 'Date-Added'

I've just begun the process of importing a large set of libraries I've been managing with bibdesk to Zotero. The only missing piece seems to be the lack of integration on the fields for 'Date-Modified' and 'Date-Added'. These are really pretty important for my workflow, as I use date to parse out which stage of research I've added items to a library. Has anyone seen work done towards this before? I've trawled github, forums and elsewhere and come up blank. Seems like this could be achieved by modifying a translation file...
  • Actually no. Import translators cannot set the date-added or date-modified. BBT will on import write these to the extra field so they'll be re-exported when you export again, but they won't (since they can't) affect the date added/modified you see in Zotero.
  • Ok, that's good to know. So will need a bit more of a plugin approach. I'm assuming it's just a matter of modifying dateModified and dateAdded. Perhaps this could be grafted into Better Bibtex (http://retorque.re/zotero-better-bibtex/)?
  • *grin* I'm the author of BBT.

    Yeah, it'd be possible, but it'd be hella ugly. I'd have to either patch the save methods for translator items, or remember which items I imported, and find and patch them after the import has finished. The latter seems way too fragile, and the former... I'm trying to minimize the number of runtime patches I install these days, as it's way too easy to destabilize Zotero this way. Zotero actively removes these dates from the import items. Preferably that would just be either removed or made optional.
  • *actually*... I could pick these up from the extra field where I already write them to... but then there's still the problem that it's conceivable that changing these timestamps would mess with syncing. I really don't want to have that on my conscience.
  • I'm in the same position. If I were to move from Bibdesk to Zotero I would lose the Date Added on 12 years of references, which is a dealbreaker.

    I appreciate the syncing issue but I don't yet have a database to sync. Perhaps the solution would be a separate tool to update the added and modified dates to match the tex.date-added and tex.date-modified extra fields left by the BBT importer?
  • @danstillman back-dating `dateAdded` shouldn't be problematic, right? And for sync, `clientDateModified` is leading IIRC, so maybe modifying `dateModified` wouldn't be problematic either?
  • @emilianoeheyns: The server used to reject dateAdded changes for existing items, but that's currently disabled because it was happening unexpectedly (I'm not sure I determined why). Realistically that probably won't be enforced again, but technically those dates aren't supposed to change.

    But now that we have an options window for imports, this should really just be an option there. I've created an issue to track this.
  • Is this option something I could detect in the translator, so I can choose between leaving it in the `extra` field and just setting the Zotero fields?

    Can I detect in the plugin whether an item has been synced? Back-dating for not-yet-synced items would be safe then I take it?
  • No, it wouldn't be exposed to translators. But if people choose not to keep the field given the option, I'm not sure why you'd worry about it.

    An item that has been synced before would have a .version > 0.
  • Imports can also be done from the clipboard, which doesn't have an UI.
  • @timmb the option that dstillman proposes is going to be a lot cleaner than what I'd be able to do. Given that it's coming to Zotero, I don't see much value in adding it in BBT; it'd be fairly hacky. If you're in a hurry, I can probably get you something for the Javascript Runner that's in Zotero, as long as you have not synced.
  • Those wouldn't use the dates.
  • @timmb @kidwellj I found myself in the same situation in wanting to preserve my Bibdesk library's date-added. I've hacked together a [Python script](https://gist.github.com/crowding/54ddca96229441a0c7bb3a087631321b) that will pull those values out of the 'extra' field. It should be used after importing your .bib file but before syncing.
  • @crowding Zotero advises against direct updates of the Zotero DB.
Sign In or Register to comment.