all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bob Rogers <rogers-emacs@rgrjr.homedns.org>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: emacs-devel@gnu.org
Subject: Allow unspecified dates in iso8601-valid-p?
Date: Mon, 4 Jul 2022 11:34:49 -0400	[thread overview]
Message-ID: <25283.2201.966447.257263@orion.rgrjr.com> (raw)
In-Reply-To: <87bku5hw0p.fsf@fastmail.fm>

   From: Joost Kremers <joostkremers@fastmail.fm>
   Date: Mon, 04 Jul 2022 14:47:08 +0200

   Hi list,

   The function `iso8601-valid-p` can be used to check if a string
   constitutes a valid ISO8601-formatted date. It seems that ISO8601 is
   a big spec with several modifications and extensions, so I'm sure
   it's hardly doable to support everything the spec allows, but I'm
   wondering if it would be possible to allow unspecified dates.

   The relevant spec is described here:

   https://www.datafix.com.au/BASHing/2020-02-12.html

   (There are several parts here, the one I'm referring to is under
   "Unspecified").  It explains that a capital X can be used to indicate
   parts of a date that are unspecified, i.e., "20XX" for a year in the
   21st century . . .

Parsing such dates would seem to require a fair amount of work, as the
design of iso8601.el does not consider partially-specified date values.
What is more, the return value is in terms of decoded time objects,
which can only describe them as either present or absent.

   But if you only want to test ISO 8601 compliance, then ISTM it would
be better (and much easier) to write a new and completely separate
`iso8601-compliant-p` predicate for that purpose, since the charter of
`iso8601-valid-p` is to tell whether iso8601.el can parse something.

					-- Bob Rogers
					   http://www.rgrjr.com/



  reply	other threads:[~2022-07-04 15:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 12:47 Allow unspecified dates in iso8601-valid-p? Joost Kremers
2022-07-04 15:34 ` Bob Rogers [this message]
2022-07-04 16:21   ` Joost Kremers
2022-07-04 16:56     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25283.2201.966447.257263@orion.rgrjr.com \
    --to=rogers-emacs@rgrjr.homedns.org \
    --cc=emacs-devel@gnu.org \
    --cc=joostkremers@fastmail.fm \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.