How to add a JavaScript to Properties?

What I’m trying to do

I’m trying to add this script to properties.

<%* let month = tp.date.now(“MM”)
if ((month == “09” || month == “10” || month == “11” || month == “12”)) { %>
Fall <% tp.date.now(“YYYY”)%>-<%tp.date.now(“YYYY”, 365) %>
<%* } else if ((month == “07” || month == “08”)) { %>
Summer <% tp.date.now(“YYYY”, -365)%>-<%tp.date.now(“YYYY”) %>
<%* } else { %>
Spring <% tp.date.now(“YYYY”, -365)%>-<%tp.date.now(“YYYY”) %>
<%* } %>

However, when I insert the template into a note. It says “Templater Error: template parsing error”

Things I have tried

I’ve tried changing the line breaks and it makes the script work, but when I open it into a new template, properties table won’t show up at all.

I’ve tried creating a user.script on templater. I have included a folder and I’ve added .js at the end of the file name, but I must be doing something wrong as it shows ‘undefined’ inside the template. Also, the templater options does not show any user scripts when I refresh it.

Your double quotation marks are invalid. You have to use " instead of or .

This kind of problem often happens when you paste a snippet from the web.
I too have suffered from this mistake many times.

(For the same reason, you should use a code block (i.e. three backticks) when you include a code snippet in your post so that everything will be displayed as is.)

<%* let month = tp.date.now("MM")
if ((month == "09" || month == "10" || month == "11" || month == "12")) { %>
Fall <% tp.date.now("YYYY")%>-<%tp.date.now("YYYY", 365) %>
<%* } else if ((month == "07" || month == "08")) { %>
Summer <% tp.date.now("YYYY", -365)%>-<%tp.date.now("YYYY") %>
<%* } else { %>
Spring <% tp.date.now("YYYY", -365)%>-<%tp.date.now("YYYY") %>
<%* } %>

P.S. Since your question is about the Templater plugin, maybe it’s better to include “Templater” in the thread title and the body of your question.

Thanks for the help and suggestion! I’ll make sure to put the plug-in it is related to.