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

Usage of length DV task field conflicts with TS string length property #101

Closed
2 tasks
stoilis opened this issue Mar 7, 2024 · 1 comment
Closed
2 tasks

Comments

@stoilis
Copy link

stoilis commented Mar 7, 2024

Is your feature request related to a problem? Please describe.
Time Ruler currently supports "length" as a task value to signify how long it lasts, if it doesn't have an endTime.
However, length is a reserved Typescript word.
When I use dataviewjs for advanced queries in obsidian, the conflict becomes more obvious.
For example, this works:

  • something [effort:: 1h]
const pages = dv.pages()
const tasks = pages.file.tasks
	.where(t => t.effort)
const total = dv.luxon.Duration.fromMillis(tasks.effort.array().reduce((acc, val) => acc + val, 0)).shiftTo('hours', 'minutes').toHuman()

But this doesn't:

  • something [length:: 1h]
const pages = dv.pages()
const tasks = pages.file.tasks
	.where(t => t.length)
const total = dv.luxon.Duration.fromMillis(tasks.length.array().reduce((acc, val) => acc + val, 0)).shiftTo('hours', 'minutes').toHuman()

Describe the solution you'd like
I recommend changing the "length" to something like "effort" or "duration". The duration term is already a DataView datatype but it should not be an issue, because the function name is "dur()".
If you want to avoid yet another potential conflict, "effort" seems like a better bet. Some people seem to already by using it this way.

@j-palindrome
Copy link
Owner

That's true and a good point. I can add support for parsing "duration" as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants