You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.
You shouldn't match on some(myDate), because in this case expression some(myDate) will always has value and completionDate will have type DateTime optional. Your code snipped is equivalent to just
{{%
"YES - Found myDate - " ++ toString(myDate)
%}}
Match should be done on myDate itself:
{{%
match myDate
with let? completionDate then "YES - Found myDate - " ++ toString(completionDate)
else "NO - myDate not found"
%}}
Converting optional value to string is quite ugly, yes.
prekel
added a commit
to prekel/ergo
that referenced
this issue
Jul 6, 2022
I agree with @prekel here some(MyDate) shouldn't be pattern matched here.
@prekel can you please create a PR (if you are willing to) for the tests that you added to the your fork I think that would be helpful in avoiding this 😃
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug Report 🐛
Please see LOOM video for demo of bug.
https://www.loom.com/share/4d628fd1e1ec4afa9d5a50444e69ebe9
In summary,
optional
variables return unexpected results when interrogated in code blocks withingrammar.tem.md
files.An optional DateTime variable
myDate
is defined as:A value in the
data.json
file is set as...A code block is defined in the
grammar.tem.md
as:A
draft
command is executed as:and the following response is returned...
When the
myDate
value is deleted fromdata.json
and the samedraft
command executed then the following response is returned.Expected Result
If
myDate
present then expectedIf
myDate
not present then expectedExample CTA archive attached:
OptionalDateTime CTA
The text was updated successfully, but these errors were encountered: