all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* icalendar--datetime-to-iso-date (icalendar.el)
@ 2016-11-03 13:27 HASM
  2016-11-04  8:30 ` tomas
  0 siblings, 1 reply; 3+ messages in thread
From: HASM @ 2016-11-03 13:27 UTC (permalink / raw)
  To: help-gnu-emacs


Shouldn't format in:
  icalendar--datetime-to-iso-date (icalendar.el)
be:
  "%04d%s%02d%s%02d"
instead of:
  "%d%s%d%s%d"?

At least that's how I read the wikipedia description of the standard:
  https://en.wikipedia.org/wiki/ISO_8601

This will allow, for those of use ISO dates with:
  (setq
   diary-date-forms    diary-iso-date-forms
   calendar-date-style 'iso
   )
 
To create a "simple' sort function for the diary, like the one below.

-- HASM

------------------------------------------------------------

(defun sort--diary (diary-filename)
  (with-current-buffer
    (set-buffer (find-file-noselect (expand-file-name diary-filename)))
    (goto-char (point-min))
    (while (search-forward "\C-j " nil t)
      (replace-match "^j "))
    (sort-lines nil (point-min) (point-max))
    (goto-char (point-min))
    (while (search-forward "^j" nil t)
      (replace-match "\C-j"))
    (save-buffer)))

(defvar sort--diary-filename (expand-file-name diary-file)
  "History for sort--diary diary-filename")

(defun sort-diary (diary-filename)
  "Sort diary file.  Requires dates to use ISO standard"
  (interactive (list (read-from-minibuffer
                      "diary file name: "
                      (car sort--diary-filename)
                      nil nil 'sort--diary-filename)))
  (sort--diary diary-filename))
  


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: icalendar--datetime-to-iso-date (icalendar.el)
  2016-11-03 13:27 icalendar--datetime-to-iso-date (icalendar.el) HASM
@ 2016-11-04  8:30 ` tomas
  2016-11-04  9:49   ` Yuri Khan
  0 siblings, 1 reply; 3+ messages in thread
From: tomas @ 2016-11-04  8:30 UTC (permalink / raw)
  To: HASM; +Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Nov 03, 2016 at 06:27:00AM -0700, HASM wrote:
> 
> Shouldn't format in:
>   icalendar--datetime-to-iso-date (icalendar.el)
> be:
>   "%04d%s%02d%s%02d"
> instead of:
>   "%d%s%d%s%d"?

That seems to make sense. After all, an ISO date looks like
"2016-08-09" and not "2016-8-9".

Consider reporting a bug with M-x report-emacs-bug.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlgcRw4ACgkQBcgs9XrR2ka41ACdHMSXnLLn9v6SgLHEZfUhgymz
ZaIAnRbwJbOGTeripN7LWXIZ0RHqv03C
=6iui
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: icalendar--datetime-to-iso-date (icalendar.el)
  2016-11-04  8:30 ` tomas
@ 2016-11-04  9:49   ` Yuri Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Yuri Khan @ 2016-11-04  9:49 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs@gnu.org, HASM

On Fri, Nov 4, 2016 at 3:30 PM,  <tomas@tuxteam.de> wrote:

>> Shouldn't format in:
>>   icalendar--datetime-to-iso-date (icalendar.el)
>> be:
>>   "%04d%s%02d%s%02d"
>> instead of:
>>   "%d%s%d%s%d"?
>
> That seems to make sense. After all, an ISO date looks like
> "2016-08-09" and not "2016-8-9".
>
> Consider reporting a bug with M-x report-emacs-bug.

Consider also that the only valid date separators are the empty string
and the hyphen-minus character, while the function in question uses
the space by default.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-04  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 13:27 icalendar--datetime-to-iso-date (icalendar.el) HASM
2016-11-04  8:30 ` tomas
2016-11-04  9:49   ` Yuri Khan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.