emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111384: * calc/calc-forms.el (math-p


From: Jay Belanger
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111384: * calc/calc-forms.el (math-parse-date): Try using
Date: Sun, 30 Dec 2012 20:58:57 -0600
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111384
committer: Jay Belanger <address@hidden>
branch nick: trunk
timestamp: Sun 2012-12-30 20:58:57 -0600
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/calc/calc-forms.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-30 18:09:01 +0000
+++ b/lisp/ChangeLog    2012-12-31 02:58:57 +0000
@@ -1,3 +1,11 @@
+2012-12-31  Jay Belanger  <address@hidden>
+
+       * 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.
+
 2012-12-30  Glenn Morris  <address@hidden>
 
        * net/mairix.el (rmail, rmail-summary-displayed, rmail-summary):

=== modified file 'lisp/calc/calc-forms.el'
--- a/lisp/calc/calc-forms.el   2012-12-11 02:37:36 +0000
+++ b/lisp/calc/calc-forms.el   2012-12-31 02:58:57 +0000
@@ -918,7 +918,7 @@
   (catch 'syntax
     (or (math-parse-standard-date math-pd-str t)
        (math-parse-standard-date math-pd-str nil)
-        (and (or (memq 'IYYY calc-date-format) (memq 'Iww calc-date-format))
+        (and (string-match "W[0-9][0-9]" math-pd-str)
              (math-parse-iso-date math-pd-str))
        (and (string-match 
"\\`[^-+/0-9a-zA-Z]*\\([-+]?[0-9]+\\.?[0-9]*\\([eE][-+]?[0-9]+\\)?\\)[^-+/0-9a-zA-Z]*\\'"
 math-pd-str)
             (list 'date (math-read-number (math-match-substring math-pd-str 
1))))
@@ -943,8 +943,12 @@
                    (setq second 0)
                  (setq second (math-read-number second)))
                (if (equal ampm "")
-                   (if (> hour 23)
-                       (throw 'syntax "Hour value out of range"))
+                   (if (or
+                         (> hour 24)
+                         (and (= hour 24)
+                              (not (= minute 0))
+                              (not (eq second 0))))
+                       (throw 'syntax "Hour value is out of range"))
                  (setq ampm (upcase (aref ampm 0)))
                  (if (memq ampm '(?N ?M))
                      (if (and (= hour 12) (= minute 0) (eq second 0))
@@ -952,7 +956,7 @@
                        (throw 'syntax
                               "Time must be 12:00:00 in this context"))
                    (if (or (= hour 0) (> hour 12))
-                       (throw 'syntax "Hour value out of range"))
+                       (throw 'syntax "Hour value is out of range"))
                    (if (eq (= ampm ?A) (= hour 12))
                        (setq hour (% (+ hour 12) 24)))))))
 
@@ -1075,7 +1079,11 @@
       (throw 'syntax "Day value is out of range"))
   (and hour
        (progn
-        (if (or (< hour 0) (> hour 23))
+        (if (or (< hour 0) 
+                 (> hour 24)
+                 (and (= hour 24)
+                      (not (= minute 0))
+                      (not (eq second 0))))
             (throw 'syntax "Hour value is out of range"))
         (if (or (< minute 0) (> minute 59))
             (throw 'syntax "Minute value is out of range"))
@@ -1091,7 +1099,11 @@
       (throw 'syntax "Weekday value is out of range"))
   (and hour
        (progn
-        (if (or (< hour 0) (> hour 23))
+        (if (or (< hour 0) 
+                 (> hour 24)
+                 (and (= hour 24)
+                      (not (= minute 0))
+                      (not (eq second 0))))
             (throw 'syntax "Hour value is out of range"))
         (if (or (< minute 0) (> minute 59))
             (throw 'syntax "Minute value is out of range"))


reply via email to

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