all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74965: Document date representations in calendar
@ 2024-12-19  8:39 Richard Lawrence
  2024-12-19  8:46 ` bug#74965: [PATCH] Document representation of dates in calendar.el Richard Lawrence
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Lawrence @ 2024-12-19  8:39 UTC (permalink / raw)
  To: 74965

Severity: minor

As discussed in this thread:

https://lists.gnu.org/archive/html/emacs-devel/2024-12/msg00291.html

it would be nice to have better documentation of the date
representations used by calendar.el. Opening a bug so I can send a patch
with a bug number. 





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

* bug#74965: [PATCH] Document representation of dates in calendar.el
  2024-12-19  8:39 bug#74965: Document date representations in calendar Richard Lawrence
@ 2024-12-19  8:46 ` Richard Lawrence
  2024-12-21 11:01   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Lawrence @ 2024-12-19  8:46 UTC (permalink / raw)
  To: 74965

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Tags: patch

Here is a patch documenting these representations in a comment.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Document-representation-of-dates-in-calendar.el.patch --]
[-- Type: text/patch, Size: 1694 bytes --]

From b81f80ca621836ff8a7bc6ae446f9abd1455d242 Mon Sep 17 00:00:00 2001
From: Richard Lawrence <rwl@recursewithless.net>
Date: Mon, 16 Dec 2024 20:46:34 +0100
Subject: [PATCH] Document representation of dates in calendar.el

* lisp/calendar/calendar.el: Add a comment in file header
explaining Gregorian and absolute representations of
dates.  (Bug#74965)
---
 lisp/calendar/calendar.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 60d8fdd6aee..54b5aebbd8b 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -90,6 +90,23 @@
 ;; <https://doi.org/10.1002/spe.4380230404>
 ;; <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.6421&rep=rep1&type=pdf>
 
+;; As described in more detail in that literature, a Gregorian calendar
+;; date in this file is represented as a list of integers (MONTH DAY YEAR).
+;; See the functions
+;; `calendar-extract-year',
+;; `calendar-extract-month', and
+;; `calendar-extract-day'
+;; which act as accessors for this representation.
+
+;; The calendar functions in this and related files also use an
+;; "absolute" representation, which is an integer number of days since
+;; December 31, 1BC on the Gregorian calendar. This representation is
+;; useful for certain calculations; e.g. `calendar-day-of-week' is
+;; simply the absolute represention modulo 7, because December 31, 1BC
+;; is a Sunday. The absolute representation is also to convert between
+;; different calendar scales: see e.g.
+;; `calendar-absolute-from-gregorian' in this file and
+;; `calendar-iso-from-absolute' in cal-iso.el.
 
 ;; A note on free variables:
 
-- 
2.39.5


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

* bug#74965: [PATCH] Document representation of dates in calendar.el
  2024-12-19  8:46 ` bug#74965: [PATCH] Document representation of dates in calendar.el Richard Lawrence
@ 2024-12-21 11:01   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-12-21 11:01 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: 74965-done

> From: Richard Lawrence <rwl@recursewithless.net>
> Date: Thu, 19 Dec 2024 09:46:49 +0100
> 
> Here is a patch documenting these representations in a comment.

Thanks.  Most of this I already installed using your previous patch.
So now I just added the missing info to what was already there.  And
with that, I'm closing this bug.





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

end of thread, other threads:[~2024-12-21 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19  8:39 bug#74965: Document date representations in calendar Richard Lawrence
2024-12-19  8:46 ` bug#74965: [PATCH] Document representation of dates in calendar.el Richard Lawrence
2024-12-21 11:01   ` Eli Zaretskii

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.