<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dates on Janusworx</title><link>https://janusworx.com/tags/dates/</link><description>Recent content in Dates on Janusworx</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>feedback@janusworx.com (Mario Jason Braganza)</managingEditor><webMaster>feedback@janusworx.com (Mario Jason Braganza)</webMaster><copyright>© 2026, Mario Jason Braganza</copyright><lastBuildDate>Sun, 31 Jul 2022 15:17:11 +0530</lastBuildDate><atom:link href="https://janusworx.com/tags/dates/index.xml" rel="self" type="application/rss+xml"/><item><title>Tomorrow is Another Date</title><link>https://janusworx.com/work/tomorrow-is-another-date/</link><pubDate>Sun, 31 Jul 2022 15:17:11 +0530</pubDate><author>feedback@janusworx.com (Mario Jason Braganza)</author><guid>https://janusworx.com/work/tomorrow-is-another-date/</guid><description>&lt;p&gt;&lt;br&gt;


&lt;figure&gt;
 &lt;img class="my-0 rounded-md" src="https://janusworx.com/images/2022/org-daily-tasks.png" alt="" /&gt;
 
 
 &lt;/figure&gt;
&lt;hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238); height: 1px;'/&gt;
&lt;/p&gt;
&lt;p&gt;&lt;a href="https://orgmode.org/" target="_blank" rel="noreferrer"&gt;Org mode&lt;/a&gt; is &lt;del&gt;slowly spreading its tentacles&lt;/del&gt; increasingly becoming something, I cannot live without, to manage my day.&lt;br&gt;
And I’m getting pretty consistent with it too!&lt;/p&gt;
&lt;p&gt;Like you see above, I use dates as my headlines, below which I list the various tasks for the day.&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;br&gt;
And that’s where I run into my current itch to scratch.&lt;/p&gt;
&lt;p&gt;I don’t want to keep typing out the date daily.&lt;br&gt;
The computer can do that for me.&lt;br&gt;
But how? Of the millions of ways possible, what do I want to do?&lt;br&gt;
My first thought was to figure out some way to &lt;a href="https://www.emacswiki.org/emacs/InsertingTodaysDate" target="_blank" rel="noreferrer"&gt;insert a date into Emacs.&lt;/a&gt;&lt;br&gt;
And then I thought, why only emacs? I want it &lt;em&gt;systemwide,&lt;/em&gt; across all my programs.&lt;br&gt;
So I checked if &lt;a href="https://espanso.org/" target="_blank" rel="noreferrer"&gt;Espanso&lt;/a&gt;, my friendly text expansion program, would do that for me.&lt;br&gt;
&lt;a href="https://espanso.org/docs/matches/basics/#dynamic-matches" target="_blank" rel="noreferrer"&gt;Turns out, Espanso does!&lt;/a&gt;&lt;br&gt;
I could just type &lt;code&gt;:dtx&lt;/code&gt; wherever I wanted and Espanso would happily insert the date in there. And so I did that for a few days.&lt;br&gt;
Problem solved? Well, that’s when the itch got stronger.&lt;br&gt;
&lt;hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238); height: 1px;'/&gt;


&lt;figure&gt;
 &lt;img class="my-0 rounded-md" src="https://janusworx.com/images/2022/org-shutdown-routine.png" alt="" /&gt;
 
 
 &lt;/figure&gt;
&lt;hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238); height: 1px;'/&gt;
&lt;/p&gt;
&lt;p&gt;See my evening tasks above?&lt;br&gt;
I use Cal Newport’s idea of a &lt;a href="https://www.calnewport.com/blog/2009/06/08/drastically-reduce-stress-with-a-work-shutdown-ritual/" target="_blank" rel="noreferrer"&gt;shutdown ritual&lt;/a&gt;, to empty my mind and plan the next day, every evening.&lt;br&gt;
Which, for the past couple of weeks meant using my little expansion snippet to put in today’s date for the next day’s headline, as I began planning it. And I’d just manually change the date part to the next day’s date.&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;Until today.&lt;/p&gt;
&lt;p&gt;I typed in &lt;code&gt;:dtx&lt;/code&gt; and I got 2022-07-31.&lt;br&gt;
And then the lazy bum inside me groaned. What? I need to the change the &lt;em&gt;month&lt;/em&gt; too?&lt;br&gt;
The computer can do that for me!&lt;/p&gt;
&lt;p&gt;So I went back to Espanso to see if it did support date expansions for tomorrow.&lt;br&gt;
&lt;a href="https://espanso.org/docs/matches/extensions/#future-and-past-dates" target="_blank" rel="noreferrer"&gt;Turns out it does!&lt;/a&gt;&lt;br&gt;
Only for some reason, it just wouldn’t play ball with the way I want my dates expressed, &lt;em&gt;(YYYY-MM-DD)&lt;/em&gt;. It would throw weird &lt;code&gt;yaml&lt;/code&gt; errors.&lt;br&gt;
And then I recalled Emacs &lt;a href="https://www.emacswiki.org/emacs/InsertingTodaysDate" target="_blank" rel="noreferrer"&gt;just called the shell to do it.&lt;/a&gt;&lt;br&gt;
So I went looking to see, if Espanso could call the operating system shell&lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt; to do expansions ala Emacs.&lt;br&gt;
&lt;a href="https://espanso.org/docs/matches/extensions/#shell-extension" target="_blank" rel="noreferrer"&gt;Turns out, it can!&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Finally, I looked up how the &lt;code&gt;date&lt;/code&gt; command worked with past and future dates, and jigged up a small expansion snippet and put that into Espanso’s &lt;code&gt;match/base.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:dttx&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;{{output}}&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;vars&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;output&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;shell&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;date --date=&amp;#39;tomorrow&amp;#39; +&amp;#39;%Y-%m-%d&amp;#39;&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br&gt;

Et voilà!&lt;br&gt;
No more backspacing and struggling with Espanso undos and date calculations.&lt;br&gt;
&lt;code&gt;:dttx&lt;/code&gt; turns into tomorrow’s date:&lt;code&gt;2022-08-01&lt;/code&gt;!&lt;br&gt;
And the monkey brain is happy again :)&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Subtasks not shown.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;like yesterday evening, I typed in &lt;code&gt;:dtx&lt;/code&gt; to get &lt;code&gt;2022-07-30&lt;/code&gt; for e.g. and then changed the &lt;code&gt;30&lt;/code&gt; to a &lt;code&gt;31&lt;/code&gt;.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;in my case, &lt;code&gt;bash&lt;/code&gt;&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item></channel></rss>