Files
klammertext/sks/date/date.k
Andy Kopra 61b21d1397 Document language for dates; @eval pathname resolution and :cwd (from dev bc7cd62b6f68)
@date/@datetime gain :lang (German: "16. Juni 1910") over a document-wide
Language state variable, and :number for the numeric form (en 6/16/1910,
de 16.06.1910 per DIN 5008).  @eval finds Python modules next to the file
that names them regardless of the cwd, and the new :cwd option runs an
eval in a chosen working directory (@source_file uses it to resolve
against the document).  Two new test suites ship in tst/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-27 20:25:49 +02:00

38 lines
1.5 KiB
Plaintext
Executable File

@@date.k :days.int 0 :lang.language :number.bool false :
Date formatted as "16 June 1910" (^:lang de: "16. Juni 1910"), offset by
^:days days from today (^:days 1 is tomorrow, ^:days -1 is yesterday).
^:lang selects the language of the month name and the date form; without
it the document-wide Language state variable applies (default en).
^:number true gives the numeric form, which is language-specific in
order, separator, and padding: "6/16/1910" (en, month first),
"16.06.1910" (de, day first, zero-padded per DIN 5008)
@@
@@date.html :: @eval date.date(K) eval@ @@
@@date.tex :: @eval date.date(K) eval@ @@
@@date.txt :: @eval date.date(K) eval@ @@
@@datetime.k :days.int 0 :lang.language :number.bool false :
Date and time formatted as "16 June 1910, 13:10" (^:lang de:
"16. Juni 1910, 13:10"), offset by ^:days days from today (^:days 1 is
tomorrow, ^:days -1 is yesterday). ^:lang and ^:number select the
language and the numeric form as for ^@date
@@
@@datetime.html :: @eval date.datetime(K) eval@ @@
@@datetime.tex :: @eval date.datetime(K) eval@ @@
@@datetime.txt :: @eval date.datetime(K) eval@ @@
@@timestamp.k : Date and time formatted as "1910.06.16-12:34" @@
@@timestamp :: @eval time.strftime("%Y.%m.%d-%H:%M") eval@ @@
@@serialdate.k : Date formatted as "YYMMDD" @@
@@serialdate :: @eval time.strftime("%y%m%d") eval@ @@
@@year.k : Current year formatted as "20XX" @@
@@year :: @eval time.strftime("%Y") eval@ @@
#[
@@@category date
date datetime timestamp serialdate
:desc Time and date formatting @@@
]#