aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2012-12-30 20:58:57 -0600
committerJay Belanger2012-12-30 20:58:57 -0600
commitfd1f1603a4f5390dc978066e72b30fc2c28591e8 (patch)
tree9b4837aa470a2dfd0428e39cff3f4b24839bf6df
parent84cc1ab62539eed7869a88003a017330d79e8cac (diff)
downloademacs-fd1f1603a4f5390dc978066e72b30fc2c28591e8.tar.gz
emacs-fd1f1603a4f5390dc978066e72b30fc2c28591e8.zip
* calc/calc-forms.el (math-parse-date): Try using
`math-parse-iso-date' when it looks like it might be needed. Allow times of 24:00. (math-parse-date-validate, math-parse-iso-date-validate): Allow times of 24:00.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/calc/calc-forms.el24
2 files changed, 26 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c895bce1cad..4887c1bfcda 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12012-12-31 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc/calc-forms.el (math-parse-date): Try using
4 `math-parse-iso-date' when it looks like it might be needed. Allow
5 times of 24:00.
6 (math-parse-date-validate, math-parse-iso-date-validate): Allow times
7 of 24:00.
8
12012-12-30 Glenn Morris <rgm@gnu.org> 92012-12-30 Glenn Morris <rgm@gnu.org>
2 10
3 * net/mairix.el (rmail, rmail-summary-displayed, rmail-summary): 11 * net/mairix.el (rmail, rmail-summary-displayed, rmail-summary):
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index 7cfca261fa3..d7c598d3b48 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -918,7 +918,7 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)."
918 (catch 'syntax 918 (catch 'syntax
919 (or (math-parse-standard-date math-pd-str t) 919 (or (math-parse-standard-date math-pd-str t)
920 (math-parse-standard-date math-pd-str nil) 920 (math-parse-standard-date math-pd-str nil)
921 (and (or (memq 'IYYY calc-date-format) (memq 'Iww calc-date-format)) 921 (and (string-match "W[0-9][0-9]" math-pd-str)
922 (math-parse-iso-date math-pd-str)) 922 (math-parse-iso-date math-pd-str))
923 (and (string-match "\\`[^-+/0-9a-zA-Z]*\\([-+]?[0-9]+\\.?[0-9]*\\([eE][-+]?[0-9]+\\)?\\)[^-+/0-9a-zA-Z]*\\'" math-pd-str) 923 (and (string-match "\\`[^-+/0-9a-zA-Z]*\\([-+]?[0-9]+\\.?[0-9]*\\([eE][-+]?[0-9]+\\)?\\)[^-+/0-9a-zA-Z]*\\'" math-pd-str)
924 (list 'date (math-read-number (math-match-substring math-pd-str 1)))) 924 (list 'date (math-read-number (math-match-substring math-pd-str 1))))
@@ -943,8 +943,12 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)."
943 (setq second 0) 943 (setq second 0)
944 (setq second (math-read-number second))) 944 (setq second (math-read-number second)))
945 (if (equal ampm "") 945 (if (equal ampm "")
946 (if (> hour 23) 946 (if (or
947 (throw 'syntax "Hour value out of range")) 947 (> hour 24)
948 (and (= hour 24)
949 (not (= minute 0))
950 (not (eq second 0))))
951 (throw 'syntax "Hour value is out of range"))
948 (setq ampm (upcase (aref ampm 0))) 952 (setq ampm (upcase (aref ampm 0)))
949 (if (memq ampm '(?N ?M)) 953 (if (memq ampm '(?N ?M))
950 (if (and (= hour 12) (= minute 0) (eq second 0)) 954 (if (and (= hour 12) (= minute 0) (eq second 0))
@@ -952,7 +956,7 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)."
952 (throw 'syntax 956 (throw 'syntax
953 "Time must be 12:00:00 in this context")) 957 "Time must be 12:00:00 in this context"))
954 (if (or (= hour 0) (> hour 12)) 958 (if (or (= hour 0) (> hour 12))
955 (throw 'syntax "Hour value out of range")) 959 (throw 'syntax "Hour value is out of range"))
956 (if (eq (= ampm ?A) (= hour 12)) 960 (if (eq (= ampm ?A) (= hour 12))
957 (setq hour (% (+ hour 12) 24))))))) 961 (setq hour (% (+ hour 12) 24)))))))
958 962
@@ -1075,7 +1079,11 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)."
1075 (throw 'syntax "Day value is out of range")) 1079 (throw 'syntax "Day value is out of range"))
1076 (and hour 1080 (and hour
1077 (progn 1081 (progn
1078 (if (or (< hour 0) (> hour 23)) 1082 (if (or (< hour 0)
1083 (> hour 24)
1084 (and (= hour 24)
1085 (not (= minute 0))
1086 (not (eq second 0))))
1079 (throw 'syntax "Hour value is out of range")) 1087 (throw 'syntax "Hour value is out of range"))
1080 (if (or (< minute 0) (> minute 59)) 1088 (if (or (< minute 0) (> minute 59))
1081 (throw 'syntax "Minute value is out of range")) 1089 (throw 'syntax "Minute value is out of range"))
@@ -1091,7 +1099,11 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)."
1091 (throw 'syntax "Weekday value is out of range")) 1099 (throw 'syntax "Weekday value is out of range"))
1092 (and hour 1100 (and hour
1093 (progn 1101 (progn
1094 (if (or (< hour 0) (> hour 23)) 1102 (if (or (< hour 0)
1103 (> hour 24)
1104 (and (= hour 24)
1105 (not (= minute 0))
1106 (not (eq second 0))))
1095 (throw 'syntax "Hour value is out of range")) 1107 (throw 'syntax "Hour value is out of range"))
1096 (if (or (< minute 0) (> minute 59)) 1108 (if (or (< minute 0) (> minute 59))
1097 (throw 'syntax "Minute value is out of range")) 1109 (throw 'syntax "Minute value is out of range"))