emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* CSV agenda export formats some day and month values as single digits
@ 2022-12-24  3:49 David O'Toole
  2022-12-25 12:57 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: David O'Toole @ 2022-12-24  3:49 UTC (permalink / raw)
  To: emacs-orgmode

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

Version: Org mode version 9.6 (release_9.6-3-ga4d38e @
/usr/local/share/emacs/29.0.60/lisp/org/)

CSV export for the agenda is formatting January 1, 2023 as "2023-1-1" and
not "2023-01-01".
The raw output is here: https://pastebin.com/raw/EyN1JbhP

The last two lines both have "2023-1-1".
This is incorrect because:

Expression: (format-time-string "%04Y-%02m-%02d" (date-to-time "2023-1-1"))
Result: "1999-12-31"

[-- Attachment #2: Type: text/html, Size: 1840 bytes --]

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

* Re: CSV agenda export formats some day and month values as single digits
  2022-12-24  3:49 CSV agenda export formats some day and month values as single digits David O'Toole
@ 2022-12-25 12:57 ` Ihor Radchenko
       [not found]   ` <CAAz1J52RFMMay3YD7RSydMfp_zHQsNfAiyhT=1J9Hq0jqkdFmg@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-25 12:57 UTC (permalink / raw)
  To: David O'Toole; +Cc: emacs-orgmode

"David O'Toole" <deeteeoh1138@gmail.com> writes:

> CSV export for the agenda is formatting January 1, 2023 as "2023-1-1" and
> not "2023-01-01".
> The raw output is here: https://pastebin.com/raw/EyN1JbhP

Could you please provide detailed steps how to obtain the erroneous CSV
output? See https://orgmode.org/manual/Feedback.html#Feedback

Note that pastebin is not available in all countries. If you can, please
send the code/text right in the email as an attachment. This is more
sustainable for future readers.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: CSV agenda export formats some day and month values as single digits
       [not found]     ` <CAAz1J51L30UjqxDZhxO4Kb5ymDJ24Qjw8tVt5iRGXCsoVfde9Q@mail.gmail.com>
@ 2022-12-26  9:23       ` Ihor Radchenko
  2022-12-26 10:19         ` Max Nikulin
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-26  9:23 UTC (permalink / raw)
  To: David O'Toole; +Cc: emacs-orgmode

[Adding Org mailing list back to CC]

"David O'Toole" <deeteeoh1138@gmail.com> writes:

> Here is a script and some files that reproduce the issue for me in a fresh
> "emacs -Q".
>
> csv-test.el  --- the test script
> csv-test.org --- the file to pull agenda items from
> csv-test.csv --- the output

Thanks!
Fixed on bugfix now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c79aedec

> GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.33, cairo version 1.16.0) of 2022-12-04
>
> Org mode version 9.6 (release_9.6-3-ga4d38e @
> /usr/local/share/emacs/29.0.60/lisp/org/)
>
>
>
> On Sun, Dec 25, 2022 at 9:37 AM David O'Toole <deeteeoh1138@gmail.com>
> wrote:
>
>> Sure, I'll follow up with steps to reproduce it, and I'll include the
>> output as an attachment.
>>
>> On Sun, Dec 25, 2022 at 7:57 AM Ihor Radchenko <yantar92@posteo.net>
>> wrote:
>>
>>> "David O'Toole" <deeteeoh1138@gmail.com> writes:
>>>
>>> > CSV export for the agenda is formatting January 1, 2023 as "2023-1-1"
>>> and
>>> > not "2023-01-01".
>>> > The raw output is here: https://pastebin.com/raw/EyN1JbhP
>>>
>>> Could you please provide detailed steps how to obtain the erroneous CSV
>>> output? See https://orgmode.org/manual/Feedback.html#Feedback
>>>
>>> Note that pastebin is not available in all countries. If you can, please
>>> send the code/text right in the email as an attachment. This is more
>>> sustainable for future readers.
>>>
>>> --
>>> Ihor Radchenko // yantar92,
>>> Org mode contributor,
>>> Learn more about Org mode at <https://orgmode.org/>.
>>> Support Org development at <https://liberapay.com/org-mode>,
>>> or support my work at <https://liberapay.com/yantar92>
>>>
>>
> csv-test,Task 1,scheduled,TODO,,2022-12-25,,Scheduled:,,1099,2022-12-25
> csv-test,Task 2,scheduled,TODO,,2022-12-26,,Scheduled:,,1099,2022-12-26
> csv-test,Task 3,scheduled,TODO,,2023-1-1,,Scheduled:,,1099,2023-1-1
> ;; GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version
> ;; 3.24.33, cairo version 1.16.0) of 2022-12-04
>
> ;; Org mode version 9.6 (release_9.6-3-ga4d38e @
> ;; /usr/local/share/emacs/29.0.60/lisp/org/)
>
> ;; started with "emacs -Q"
>
> (defun capture-csv ()
>   (save-excursion 
>     (with-output-to-string
>       "*csv*"
>       (org-batch-agenda-csv "a"
>                             org-agenda-span 10
>                             org-agenda-include-inactive-timestamps t
>                             org-agenda-skip-timestamp-if-done nil
>                             org-agenda-show-all-dates t
>                             org-agenda-skip-scheduled-if-done nil))))
>
> (setq org-agenda-files '("~/csv-test.org"))
>
> (let ((buffer (get-buffer-create "*csv*")))
>   (switch-to-buffer buffer)
>   (save-window-excursion
>     (insert (capture-csv))))
>
>
>

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: CSV agenda export formats some day and month values as single digits
  2022-12-26  9:23       ` Ihor Radchenko
@ 2022-12-26 10:19         ` Max Nikulin
  2022-12-26 10:34           ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Max Nikulin @ 2022-12-26 10:19 UTC (permalink / raw)
  To: emacs-orgmode

On 26/12/2022 16:23, Ihor Radchenko wrote:
> 
> Fixed on bugfix now.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c79aedec

I have never heard about `calendar-date-display' before so I am curious 
under which circumstances the following will not work:

(let ((calendar-date-display-form calendar-iso-date-display-form))



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

* Re: CSV agenda export formats some day and month values as single digits
  2022-12-26 10:19         ` Max Nikulin
@ 2022-12-26 10:34           ` Ihor Radchenko
  2022-12-26 15:07             ` Max Nikulin
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-26 10:34 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 26/12/2022 16:23, Ihor Radchenko wrote:
>> 
>> Fixed on bugfix now.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c79aedec
>
> I have never heard about `calendar-date-display' before so I am curious 
> under which circumstances the following will not work:
>
> (let ((calendar-date-display-form calendar-iso-date-display-form))

Your variant should also work, and it is more concise. Could you make it
into a patch? But not using the variable. Rather, the default value.

The reason I suggest using the default value is that
`calendar-iso-date-display-form' is a defcustom. There is no reason why
agenda export should depend on changed custom setting here.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: CSV agenda export formats some day and month values as single digits
  2022-12-26 10:34           ` Ihor Radchenko
@ 2022-12-26 15:07             ` Max Nikulin
  2022-12-27 10:20               ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Max Nikulin @ 2022-12-26 15:07 UTC (permalink / raw)
  To: emacs-orgmode

On 26/12/2022 17:34, Ihor Radchenko wrote:
> Max Nikulin writes:
>> (let ((calendar-date-display-form calendar-iso-date-display-form))
...
> The reason I suggest using the default value is that
> `calendar-iso-date-display-form' is a defcustom.

Thank you, I did not noticed that it is a user option. I should think 
more on this. If a user has a reason to override the ISO format, perhaps 
it should be respected in some way.



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

* Re: CSV agenda export formats some day and month values as single digits
  2022-12-26 15:07             ` Max Nikulin
@ 2022-12-27 10:20               ` Ihor Radchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-27 10:20 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

>> The reason I suggest using the default value is that
>> `calendar-iso-date-display-form' is a defcustom.
>
> Thank you, I did not noticed that it is a user option. I should think 
> more on this. If a user has a reason to override the ISO format, perhaps 
> it should be respected in some way.

It will not be very obvious that calendar-related customization will
affect agenda export. If we want to allow customizing csv export format,
we need to introduce agenda-specific customization instead.

I suggest keeping this as a constant for now and provide a defcustom if
there is interest. There haven't been any until now, including this
report, which merely pointed to a bug.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2022-12-27 10:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24  3:49 CSV agenda export formats some day and month values as single digits David O'Toole
2022-12-25 12:57 ` Ihor Radchenko
     [not found]   ` <CAAz1J52RFMMay3YD7RSydMfp_zHQsNfAiyhT=1J9Hq0jqkdFmg@mail.gmail.com>
     [not found]     ` <CAAz1J51L30UjqxDZhxO4Kb5ymDJ24Qjw8tVt5iRGXCsoVfde9Q@mail.gmail.com>
2022-12-26  9:23       ` Ihor Radchenko
2022-12-26 10:19         ` Max Nikulin
2022-12-26 10:34           ` Ihor Radchenko
2022-12-26 15:07             ` Max Nikulin
2022-12-27 10:20               ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).