[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master dea7748 39/46: tiny.el (tiny-date): improve
From: |
Oleh Krehel |
Subject: |
[elpa] master dea7748 39/46: tiny.el (tiny-date): improve |
Date: |
Sun, 22 Mar 2015 17:42:38 +0000 |
branch: master
commit dea774811a5a68aad826dae87a7efecedef52ec8
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
tiny.el (tiny-date): improve
* tiny.el (tiny-date): Will recognize e.g. "Mon" and "Mon 10:00" and
format appropriately.
---
tiny.el | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tiny.el b/tiny.el
index 339389c..4d95438 100644
--- a/tiny.el
+++ b/tiny.el
@@ -391,13 +391,19 @@ Return nil if nothing was matched, otherwise
"Return date representation of S.
`org-mode' format is used.
Optional SHIFT argument is the integer amount of days to shift."
- (let ((time (apply 'encode-time
- (org-read-date-analyze
- s nil
- (decode-time (current-time))))))
+ (let* ((ct (decode-time (current-time)))
+ (time (apply 'encode-time
+ (org-read-date-analyze
+ s nil
+ ct)))
+ (formatter
+ (if (equal (cl-subseq ct 1 3)
+ (cl-subseq (decode-time time) 1 3))
+ "%Y-%m-%d %a"
+ "%Y-%m-%d %a %H:%M")))
(when shift
(setq time (time-add time (days-to-time shift))))
- (format-time-string "%Y-%m-%d %a" time)))
+ (format-time-string formatter time)))
(provide 'tiny)
;;; tiny.el ends here
- [elpa] master 80cd28f 28/46: tiny-test.el: added a test for `tiny-replace-this-sexp', (continued)
- [elpa] master 80cd28f 28/46: tiny-test.el: added a test for `tiny-replace-this-sexp', Oleh Krehel, 2015/03/22
- [elpa] master 08ba593 24/46: tiny.el: fixed `tiny-tokenize', Oleh Krehel, 2015/03/22
- [elpa] master e6abbc6 31/46: tiny.el (tiny-date): renamed from t-date. In format string it's just "date", Oleh Krehel, 2015/03/22
- [elpa] master c59bc94 36/46: tiny.el (tiny-extract-sexps): add missing let binding, Oleh Krehel, 2015/03/22
- [elpa] master cf74dd1 34/46: tiny.el: fix docs, Oleh Krehel, 2015/03/22
- [elpa] master b843226 26/46: tiny.el: removed `tiny-replace-sexp-desperately', Oleh Krehel, 2015/03/22
- [elpa] master 7893a02 35/46: tiny.el: add autoload to `tiny-expand', Oleh Krehel, 2015/03/22
- [elpa] master 075e4d0 33/46: Fix "m10|%0.2f", Oleh Krehel, 2015/03/22
- [elpa] master 4eef4e6 37/46: tiny.el: add a test case, Oleh Krehel, 2015/03/22
- [elpa] master 3a56283 38/46: tiny.el (tiny-mapconcat-parse): case-sensitive, Oleh Krehel, 2015/03/22
- [elpa] master dea7748 39/46: tiny.el (tiny-date): improve,
Oleh Krehel <=
- [elpa] master ea7a184 42/46: tiny-test.el (tiny-mapconcat): Add test., Oleh Krehel, 2015/03/22
- [elpa] master d37646a 41/46: Add Travis CI testing and Coveralls.io reporting, Oleh Krehel, 2015/03/22
- [elpa] master fe0bade 43/46: tiny-test.el: Update, Oleh Krehel, 2015/03/22
- [elpa] master 5f25ce1 40/46: tiny.el: handle quotes in FMT part, Oleh Krehel, 2015/03/22
- [elpa] master fa90c2f 44/46: README.md: Add badges, Oleh Krehel, 2015/03/22
- [elpa] master 6719ab2 32/46: README.md: updated., Oleh Krehel, 2015/03/22
- [elpa] master 159c3f7 45/46: tiny.el: Update Copyright, Oleh Krehel, 2015/03/22
- [elpa] master 3f035ad 46/46: Add 'packages/tiny/' from commit '159c3f74e75970808b83fe4b732f180cb76872a3', Oleh Krehel, 2015/03/22