Unexpected token 'M' at column 44 in expression

Got a call about an error on a page this morning. I’m getting an error:

Unexpected token ‘M’ at column 44 in expression [query1.data.sort==‘setOrderDate.formatDate(‘MM/dd/yyyy’)’ && query1.data.dir == ‘asc’]

Nothing has changed on the page recently and worked before. I search for the error and find it here:

<th class="sorting" dmx-on:click="query1.set('sort','setOrderDate.formatDate('MM/dd/yyyy')');query1.set('dir',query1.data.dir == 'desc' ? 'asc' : 'desc')" dmx-class:sorting_asc="query1.data.sort=='setOrderDate.formatDate('MM/dd/yyyy')' && query1.data.dir == 'asc'" dmx-class:sorting_desc="query1.data.sort=='setOrderDate.formatDate('MM/dd/yyyy')' && query1.data.dir == 'desc'">Order Date</th>

If I remove the 2 dmx-class: sections then the page will load. Just won’t sort. I don’t see any extra ‘M’ lines in the statement. Any ideas?

Are you sure that sort property is correct? At least the parse error is because the inner quotes need extra escaping query1.data.sort=='setOrderDate.formatDate(\'MM/dd/yyyy\')'. Normally the sort is just the field name and not an expression.

That fixed the error. That’s weird that it worked before?

Thanks
@patrick

Why do you use the .formatDate(\'MM/dd/yyyy\') for the sorting?

I guess I don’t know? I did this page quite a while ago and have slept since then. This page is kind of weird because I’m using 2 databases and all kinds of linked tables to get the data and the repeat was based off of a repeat. So short answer I guess is I don’t know. LOL

So I guess I can just drop the formateDate?

Lot of guessing going on here. Happy Monday!