emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 6267cf7 3/6: Refine passport field string output


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 6267cf7 3/6: Refine passport field string output
Date: Sun, 8 Oct 2017 17:54:11 -0400 (EDT)

branch: externals/ebdb
commit 6267cf7e6e0ca0bc3375dc775a5c157303cccb73
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Refine passport field string output
    
    * ebdb.el (ebdb-string): The ebdb-string method should also output
      issue and expiration dates.
    * ebdb-com.el (ebdb-fmt-field): The ebdb-fmt-field method can just do
      country and number.
---
 ebdb-com.el |  8 ++++++++
 ebdb.el     | 11 +++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 0723d2e..93a5984 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -464,6 +464,14 @@ property is the field instance itself."
   (with-slots (bank-name account-name) field
     (format "%s: %s" bank-name account-name)))
 
+
+(cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
+                             (field ebdb-field-passport)
+                             _style
+                             (_record ebdb-record))
+  (with-slots (country number) field
+    (format "(%s) %s" country number)))
+
 (cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
                              (field ebdb-field-mail)
                              _style
diff --git a/ebdb.el b/ebdb.el
index 8b452d7..587a4f0 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2378,8 +2378,15 @@ record uuids.")
     (cl-call-next-method class slots obj)))
 
 (cl-defmethod ebdb-string ((field ebdb-field-passport))
-  (with-slots (country number) field
-    (format "(%s) %s" country number)))
+  (with-slots (country number issue-date expiration-date) field
+    (format "(%s) %s\nIssued: %s\nExpires: %s"
+           country number
+           (format-time-string
+            "%F" (apply #'encode-time 0 0 0
+                        (calendar-gregorian-from-absolute issue-date)))
+           (format-time-string
+            "%F" (apply #'encode-time 0 0 0
+                        (calendar-gregorian-from-absolute expiration-date))))))
 
 ;;; The cache class
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]