201201 (org-test-at-time "2014-03-04"
202202 (org-read-date
203203 t nil "+1y" nil
204- (apply #'encode-time ( org-parse- time-string "2012-03-29") )))))
204+ (org-time-string-to-time "2012-03-29")))))
205205 (should
206206 (equal
207207 "2013-03-29"
208208 (org-test-at-time "2014-03-04"
209209 (org-read-date
210210 t nil "++1y" nil
211- (apply #'encode-time ( org-parse- time-string "2012-03-29") )))))
211+ (org-time-string-to-time "2012-03-29")))))
212212 ;; When `org-read-date-prefer-future' is non-nil, prefer future
213213 ;; dates (relatively to now) when incomplete. Otherwise, use
214214 ;; default date.
255255 (let ((org-read-date-prefer-future t))
256256(org-read-date
257257 t nil "1" nil
258- (apply #'encode-time ( org-parse- time-string "2012-03-29") ))))))
258+ (org-time-string-to-time "2012-03-29"))))))
259259 (should
260260 (equal
261261 "2014-03-25"
262262 (org-test-at-time "2014-03-04"
263263 (let ((org-read-date-prefer-future t))
264264(org-read-date
265265 t nil "25" nil
266- (apply #'encode-time ( org-parse- time-string "2012-03-29") )))))))
266+ (org-time-string-to-time "2012-03-29")))))))
267267
268268(ert-deftest test-org/org-parse-time-string ()
269269 "Test `org-parse-time-string'."
@@ -5538,8 +5538,7 @@ Paragraph<point>"
55385538 (equal "* H\nDEADLINE: <2012-03-29 -705d>"
55395539 (cl-letf (((symbol-function 'org-read-date)
55405540 (lambda (&rest args)
5541- (apply #'encode-time
5542- (org-parse-time-string "2014-03-04")))))
5541+ (org-time-string-to-time "2014-03-04"))))
55435542 (org-test-with-temp-text "* H\nDEADLINE: <2012-03-29>"
55445543 (let ((org-adapt-indentation nil)
55455544 (org-last-inserted-timestamp nil))
@@ -5548,8 +5547,7 @@ Paragraph<point>"
55485547 (should-error
55495548 (cl-letf (((symbol-function 'org-read-date)
55505549 (lambda (&rest args)
5551- (apply #'encode-time
5552- (org-parse-time-string "2014-03-04")))))
5550+ (org-time-string-to-time "2014-03-04"))))
55535551 (org-test-with-temp-text "* H"
55545552 (let ((org-adapt-indentation nil)
55555553 (org-last-inserted-timestamp nil))
@@ -5652,8 +5650,7 @@ Paragraph<point>"
56525650 (equal "* H\nSCHEDULED: <2012-03-29 -705d>"
56535651 (cl-letf (((symbol-function 'org-read-date)
56545652 (lambda (&rest args)
5655- (apply #'encode-time
5656- (org-parse-time-string "2014-03-04")))))
5653+ (org-time-string-to-time "2014-03-04"))))
56575654 (org-test-with-temp-text "* H\nSCHEDULED: <2012-03-29>"
56585655 (let ((org-adapt-indentation nil)
56595656 (org-last-inserted-timestamp nil))
@@ -5662,8 +5659,7 @@ Paragraph<point>"
56625659 (should-error
56635660 (cl-letf (((symbol-function 'org-read-date)
56645661 (lambda (&rest args)
5665- (apply #'encode-time
5666- (org-parse-time-string "2014-03-04")))))
5662+ (org-time-string-to-time "2014-03-04"))))
56675663 (org-test-with-temp-text "* H"
56685664 (let ((org-adapt-indentation nil)
56695665 (org-last-inserted-timestamp nil))
@@ -7929,7 +7925,7 @@ CLOSED: %s
79297925 (org-test-with-temp-text "Te<point>xt"
79307926 (cl-letf (((symbol-function 'org-read-date)
79317927 (lambda (&rest args)
7932- (apply #'encode-time ( org-parse- time-string "2014-03-04") ))))
7928+ (org-time-string-to-time "2014-03-04"))))
79337929(org-time-stamp nil)
79347930(buffer-string)))))
79357931 ;; With a prefix argument, also insert time.
@@ -7939,8 +7935,7 @@ CLOSED: %s
79397935 (org-test-with-temp-text "Te<point>xt"
79407936 (cl-letf (((symbol-function 'org-read-date)
79417937 (lambda (&rest args)
7942- (apply #'encode-time
7943- (org-parse-time-string "2014-03-04 00:41")))))
7938+ (org-time-string-to-time "2014-03-04 00:41"))))
79447939(org-time-stamp '(4))
79457940(buffer-string)))))
79467941 ;; With two universal prefix arguments, insert an active timestamp
@@ -7959,7 +7954,7 @@ CLOSED: %s
79597954 (org-test-with-temp-text "Te<point>xt"
79607955 (cl-letf (((symbol-function 'org-read-date)
79617956 (lambda (&rest args)
7962- (apply #'encode-time ( org-parse- time-string "2014-03-04") ))))
7957+ (org-time-string-to-time "2014-03-04"))))
79637958(org-time-stamp nil t)
79647959(buffer-string)))))
79657960 ;; When called from a timestamp, replace existing one.
@@ -7969,7 +7964,7 @@ CLOSED: %s
79697964 (org-test-with-temp-text "<2012-03-29<point> thu.>"
79707965 (cl-letf (((symbol-function 'org-read-date)
79717966 (lambda (&rest args)
7972- (apply #'encode-time ( org-parse- time-string "2014-03-04") ))))
7967+ (org-time-string-to-time "2014-03-04"))))
79737968(org-time-stamp nil)
79747969(buffer-string)))))
79757970 (should
@@ -7978,7 +7973,7 @@ CLOSED: %s
79787973 (org-test-with-temp-text "<2012-03-29<point> thu.>--<2014-03-04 tue.>"
79797974 (cl-letf (((symbol-function 'org-read-date)
79807975 (lambda (&rest args)
7981- (apply #'encode-time ( org-parse- time-string "2014-03-04") ))))
7976+ (org-time-string-to-time "2014-03-04"))))
79827977(org-time-stamp nil)
79837978(buffer-string)))))
79847979 ;; When replacing a timestamp, preserve repeater, if any.
@@ -7988,7 +7983,7 @@ CLOSED: %s
79887983 (org-test-with-temp-text "<2012-03-29<point> thu. +2y>"
79897984 (cl-letf (((symbol-function 'org-read-date)
79907985 (lambda (&rest args)
7991- (apply #'encode-time ( org-parse- time-string "2014-03-04") ))))
7986+ (org-time-string-to-time "2014-03-04"))))
79927987(org-time-stamp nil)
79937988(buffer-string)))))
79947989 ;; When called twice in a raw, build a date range.
@@ -7998,7 +7993,7 @@ CLOSED: %s
79987993 (org-test-with-temp-text "<2012-03-29 thu.><point>"
79997994 (cl-letf (((symbol-function 'org-read-date)
80007995 (lambda (&rest args)
8001- (apply #'encode-time ( org-parse- time-string "2014-03-04") ))))
7996+ (org-time-string-to-time "2014-03-04"))))
80027997(let ((last-command 'org-time-stamp)
80037998 (this-command 'org-time-stamp))
80047999 (org-time-stamp nil))
@@ -8173,17 +8168,15 @@ CLOSED: %s
81738168 "<2012-03-29 .+>"
81748169 (org-element-interpret-data
81758170 (org-timestamp-from-time
8176- (apply #'encode-time
8177- (org-parse-time-string "<2012-03-29 Thu 16:40>"))))))
8171+ (org-time-string-to-time "<2012-03-29 Thu 16:40>")))))
81788172 ;; When optional argument WITH-TIME is non-nil, provide time
81798173 ;; information.
81808174 (should
81818175 (string-match-p
81828176 "<2012-03-29 .+ 16:40>"
81838177 (org-element-interpret-data
81848178 (org-timestamp-from-time
8185- (apply #'encode-time
8186- (org-parse-time-string "<2012-03-29 Thu 16:40>"))
8179+ (org-time-string-to-time "<2012-03-29 Thu 16:40>")
81878180 t))))
81888181 ;; When optional argument INACTIVE is non-nil, return an inactive
81898182 ;; timestamp.
@@ -8192,8 +8185,7 @@ CLOSED: %s
81928185 "[2012-03-29 .+]"
81938186 (org-element-interpret-data
81948187 (org-timestamp-from-time
8195- (apply #'encode-time
8196- (org-parse-time-string "<2012-03-29 Thu 16:40>"))
8188+ (org-time-string-to-time "<2012-03-29 Thu 16:40>")
81978189 nil t)))))
81988190
81998191(ert-deftest test-org/timestamp-to-time ()
0 commit comments