Skip to content

Bases formula docs appear to differ from observed runtime behavior #1095

Description

@callumalpass

What is the problem in the documentation?

Is it missing something? Is the information incorrect?

Some Bases syntax/functions documentation appears to differ from behavior observed in Obsidian's live Bases formula runtime.

I am not sure whether every item below is a documentation issue or a runtime issue, but the public docs currently describe behavior that does not seem to work as written.

Affected pages:

1. Date subtraction return type

The Bases syntax docs currently say:

Subtract two dates to get the millisecond difference between the two

They also give an example like:

(now() + "1d") - now()

returning:

86400000

Observed behavior in the current Bases formula runtime: subtracting two dates returns a Duration value, not a number of milliseconds.

Example:

date("2026-06-11") - date("2026-06-10")

Observed result renders as something like:

a day

And coercing it with number(...) produces an error rather than a millisecond number:

number(date("2026-06-11") - date("2026-06-10"))

This looks like stale documentation after the 1.9.3 duration change.

2. Direct numeric method call examples

The functions docs include examples such as:

1.isTruthy()
123.toString()
5.isEmpty()

Observed behavior: direct numeric member syntax is rejected by the Bases parser.

The parenthesized form works:

(1).isTruthy()
(123).toString()
(5).isEmpty()

If the parser behavior is intended, the docs should probably use the parenthesized form for numeric literals.

3. Object literal examples

The functions docs describe object type behavior using object literals, for example:

{"a": 1, "b": 2}
{}.isEmpty()

Observed behavior: object literal expressions appear to be rejected by the Bases parser.

Examples that fail in the observed runtime:

{"a": 1, "b": 2}.keys()
{}.isEmpty()

If object literal syntax is not currently supported in Bases formulas, the object examples may need to avoid object literals or clarify that object values come from runtime objects such as file.properties.

If object literal syntax is intended to be supported, this may be a parser/runtime issue instead of a documentation issue.

Any suggested fixes?

If it were you handling this issue, what would you do to fix it?

I would update the docs to clarify the intended behavior for each case:

  1. Update date subtraction docs to say that subtracting two dates returns a Duration, not a millisecond number. The existing millisecond example could be replaced with a duration-oriented example such as:

    note.release_date - today()
  2. Update direct numeric method examples to use parenthesized numeric literals if direct numeric member syntax is not intended:

    (1).isTruthy()
    (123).toString()
    (5).isEmpty()
  3. Clarify object examples:

    • If object literals are not supported, avoid examples like {} or {"a": 1} and show object methods on runtime-provided objects such as file.properties.
    • If object literals are intended to work, this may need a runtime/parser issue instead of a docs-only change.

For any item where the app behavior is unintended, it would be helpful to note that in the docs issue and redirect to the appropriate app bug-report channel.

Have any context we can refer to?

For example, a Discord link, an existing doc site, etc.

The Obsidian 1.9.3 Desktop changelog says:

Added a new "duration" type. You can use this to display the difference between dates (e.g. note.release_date - today()).

Source:

https://obsidian.md/changelog/2025-06-26-desktop-v1.9.3/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior in the docs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions