This is a tiny change that just checks for a 'date' field if 'year' is
nil, and if present, grabs the first four characters.

Bruce
From feee2ca6d54d3495050de334c258438950494372 Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdar...@gmail.com>
Date: Fri, 29 Oct 2021 08:17:43 -0400
Subject: [PATCH] oc-basic: Support biblatex date field

* lisp/oc-basic.el (org-cite-basic--print-bibliography,
org-cite-basic--get-year): Check 'date' field if 'year' nil.
---
 lisp/oc-basic.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 1a01ea408..1c5634341 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -345,7 +345,9 @@ patterns."
   ;; the cite key, as a string, and SUFFIX is the generated suffix
   ;; string, or the empty string.
   (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw))
-         (year (org-cite-basic--get-field 'year entry-or-key info 'raw))
+         (year
+          (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
+              (substring (org-cite-basic--get-field 'date entry-or-key info 'raw) 0 4)))
          (cache-key (cons author year))
          (key
           (pcase entry-or-key
@@ -371,7 +373,9 @@ ENTRY is an alist, as returned by `org-cite-basic--get-entry'.
 Optional argument INFO is the export state, as a property list."
   (let ((author (org-cite-basic--get-field 'author entry info))
         (title (org-cite-basic--get-field 'title entry info))
-        (year (org-cite-basic--get-field 'year entry info))
+        (year
+         (or (org-cite-basic--get-field 'year entry info)
+             (substring (org-cite-basic--get-field 'date entry info) 0 4)))
         (from
          (or (org-cite-basic--get-field 'publisher entry info)
              (org-cite-basic--get-field 'journal entry info)
-- 
2.33.1

Reply via email to