Unexpected behavior with .year()

I’ve lost a little hair with the following confusion. The situation arose when writing an agent query. I’ve tried to provide a simple case for input here:

Note Name: ‘2024/02/13’
Note Rule: $Text=$Name.year()==2024

Expected result: ‘1’ or an equivalent for true

What I see: 2024

If I change the rule to either:




Then the what I see is: ‘1’

I think the attribute/method access should work but it isn’t. I am: Version 9.7.3 (b673)

That’s odd! I tried this rule on a note named “1/20/2024”


and $Text is indeed “1”. (If I write $Name.year()==2024, on the other hand, I get “2024”.)

But this rule makes me nervous in several direction.

  1. The .year() operator is really intended for dates. It might be better to write:
var:date theDate=date($Name);

  1. Assignment and equality operators on the same line frighten me, because I’m seldom entirely confident which binds more tightly in any given language. So I think explicit parens would be better: `$Text=(…==…)

  2. I agree that it would be better if your original formulation did work, and I don’t know why it doesn’t. I’ll find out.e

1 Like

OK: the issue is that the date accessor dot-operators don’t like the optional empty argument list. So $Name.year is fine, $Name.year() isn’t. I think this will be fixed shortly.


agree about the binding of assignment/equality - I was definitely being fast and dirty.