Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/dadd/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# dadd - Date Add

This package is an utility for quick date calculation like insert the date that is +12 from tomorrow,
or -5 day from today.

The package contain only one trigger that is :dadd (short for date add).
Comment on lines +3 to +6

![screenshot](screenshot.png)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the inclusion of the screenshot. We might find the Hub frontend fails as a result, however. Let's see!


The form has two field:
- Day num: Number of days to add or extract. For extraction use negative number.
- Date base (YYYY-MM-DD format): The date that will be used for add or extract. 'Today' and 'Now' are also valid values. 'Today' is the default.
Comment on lines +10 to +12

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.


The output will be also in YYYY-MM-DD format.

# Installation

@smeech smeech May 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could omit installation instructions as they'll be added to the Hub page automatically.
I suppose there's an argument for including them in case someone is browsing the espanso/hub repo instead, but the espanso restart will happen automaticaly so isn't required anyway.


```
espanso install dadd
espanso restart
```
7 changes: 7 additions & 0 deletions packages/dadd/0.1.0/_manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "dadd"
title: "Date add package"
description: An utility for quick date calculations

@smeech smeech May 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it would be nice. The description: value forms the text at the top of the package's Hub page.

homepage: "https://github.com/undergrinder/espanso-hub/tree/main/packages/dadd/0.1.0"
version: 0.1.0
author: undergrinder
tags: ["math", "utility"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you kindly add some additional tags, such as "date", "python" etc. as in my own date-offset packages, please?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thank you for all the observation, I try to fix all of them as soon as possible.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome. Let me know if you'd like any help.

29 changes: 29 additions & 0 deletions packages/dadd/0.1.0/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
matches:
- trigger: ":dadd"
replace: "{{result_dateadd}}"
vars:
- name: "input_dateadd"
type: "form"
params:
layout: |
Day num: [[dayTimeDelta]]
Date base (YYYY-MM-DD format): [[dateBase]]
fields:
dayTimeDelta:
default: "1"
dateBase:
default: "today"
- name: result_dateadd
type: script
params:
args:
- python
- -c
- |
from datetime import datetime, timedelta
clean_input = '{{input_dateadd.dateBase}}'.strip("' \"").replace('.', '-')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

if clean_input in ['now', 'today']:
Comment on lines +23 to +25

@smeech smeech May 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's necessary - the trigger will simply fail if the user enters invalid characters.

dt = datetime.today().date()
else:
dt = datetime.strptime(clean_input, '%Y-%m-%d')
print(f"{dt + timedelta(days=int('{{input_dateadd.dayTimeDelta}}'))}")
Comment on lines +28 to +29

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. 1958-03-18 00:00:00 doesn't really make sense when all you want is 1958-03-18.

Binary file added packages/dadd/0.1.0/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.