Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More intelligent custom date parsing in calendar #1575

Open
1 task done
NicholasZolton opened this issue Sep 9, 2024 · 0 comments
Open
1 task done

More intelligent custom date parsing in calendar #1575

NicholasZolton opened this issue Sep 9, 2024 · 0 comments
Labels
feature Issues related to feature proposals. Please attach a module.

Comments

@NicholasZolton
Copy link

NicholasZolton commented Sep 9, 2024

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

Emacs' Org had the ability to use fairly intelligent syntax for the org-read-date function.

You could use a fairly large amount of natural language date inputs and it would handle many of them with ease:

Assuming today is 9/8/2024:

next tuesday -> 9/10/2024

next sunday -> 9/14/2024

last tuesday -> 9/3/2024

+4d -> 9/12/2024

-4d -> 9/4/2024

and so on, including syntax with time/date ranges, translating am/pm, combinations of relative syntax (tuesday+3d) and other things.

In Neorg this kind of syntax would be incredibly useful for the calendar module's "custom input" which, to my understanding, is processed by tempus and handles some formats but is not nearly as complex as Org's implementation.

Even just having a simple version of this would be quite useful (I fully realize how complex this functionality is in org) for speeding up the time it takes to select dates using the calendar.

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

I'd be happy to start working on this functionality with a few caveats:

This is a massive feature to implement (at least it appears that way looking at the org implementation) so I would likely prefer to start with a very simple version of it (perhaps only handling the generalized example cases above for starters). On top of this, there many different formats (and languages) that would have to be added to make this feature fully inclusive, so I would prefer to focus on ISO 8601 and English to start.

Also, before I'd begin, I want to better understand a little about the current state of the tempus core module. My understanding is that this would be a great addition specifically to the tempus core module, but it is best to avoid modifying the core modules at all. Because of this, I would love a little more insight on where it would be best to implement this feature.

In terms of getting the calendar to use this instead of (or in addition to) the current parse_date function, it seems like this would be as simple as a function change but I also want to make sure I fully understand the reasoning behind the "custom input" as well, prior to changing it.

It's also worth noting that org-mode uses regex extensively for this feature, and my understanding is that Lua does not have a native regex library, and, although Vim does, it has been a decision choice to avoid Vimscript whenever possible (so please let me know if this is a situation where Vimscript would be acceptable, or if it would be preferred to have a more simple implementation in pure Lua).

@NicholasZolton NicholasZolton added the feature Issues related to feature proposals. Please attach a module. label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues related to feature proposals. Please attach a module.
Projects
None yet
Development

No branches or pull requests

1 participant