GNU bug report logs -
#46505
27.1.91; Having a hard time manipulating a date
Previous Next
Reported by: Damien Cassou <damien <at> cassou.me>
Date: Sun, 14 Feb 2021 10:44:01 UTC
Severity: minor
Found in version 27.1.91
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46505 in the body.
You can then email your comments to 46505 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46505
; Package
emacs
.
(Sun, 14 Feb 2021 10:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Damien Cassou <damien <at> cassou.me>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 14 Feb 2021 10:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
I'm finding it very hard to manipulate dates.
What I want:
Example input: "2021-01-20"
Corresponding expected output: "20 Jan 2021"
What I tried:
(format-time-string "%d %b %Y" (iso8601-parse "2021-01-20"))
⇒ invalid time specification
(format-time-string "%d %b %Y" (iso8601-parse "2021-01-20T00:00:00"))
⇒ "01 Jan 1970" ;; note the wrong year
What works:
(format-time-string
"%d %b %Y"
(encode-time (iso8601-parse "2021-01-20T00:00:00")))
⇒ "20 Jan 2021"
I found the Elisp manual confusing with all the date formats, all the
functions and their different kinds of arguments.
Possible improvements:
- make format-time-string accept as 2nd argument the return value of
(iso8601-parse "2021-01-20T00:00:00") with a correct year
- make format-time-string accept as 2nd argument the return value of
(iso8601-parse "2021-01-20") without sending an "invalid time
specification"
- restructure the manual to start with a page describing the different
time formats used throughout Emacs with a table listing all conversion
functions, the kind of input they take and the kind of output they
generate and examples for each.
In GNU Emacs 27.1.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.21, cairo version 1.16.0) Windowing system distributor 'Fedora
Project', version 11.0.12010000 System Description: Fedora 33
(Workstation Edition)
Best,
--
Damien Cassou
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46505
; Package
emacs
.
(Fri, 17 Jun 2022 14:06:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 46505 <at> debbugs.gnu.org (full text, mbox):
Damien Cassou <damien <at> cassou.me> writes:
> Possible improvements:
>
> - make format-time-string accept as 2nd argument the return value of
> (iso8601-parse "2021-01-20T00:00:00") with a correct year
>
> - make format-time-string accept as 2nd argument the return value of
> (iso8601-parse "2021-01-20") without sending an "invalid time
> specification"
format-time-string takes Lisp timestamps as arguments, not decoded time
structures, and I don't think that could change -- the formats are
syntactically ambiguous.
> - restructure the manual to start with a page describing the different
> time formats used throughout Emacs with a table listing all conversion
> functions, the kind of input they take and the kind of output they
> generate and examples for each.
But I've now improved the documentation here to clarify which functions
take and return Lisp timestamps vs. decoded time structures.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
46505 <at> debbugs.gnu.org and Damien Cassou <damien <at> cassou.me>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 17 Jun 2022 14:06:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 16 Jul 2022 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 364 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.