0

Issue

In my SPFx app I am using search to pull back events. Everything is working great, except in IE and Edge. I have determined what it doesn't like, but not why it doesn't like it.

Rendered Search Query:

contenttype:Event CompanyEventDate=7/1/2018..9/30/2018

Instead of hard-coding this and having to update every month, I have methods that calculate last month's start date and next month's end date.

So my actual line of code looks like this (This does not work in IE or Edge):

return SearchQueryBuilder.create(`${this.props.searchQuery} CompanyEventDate=${this._getMonthStartSearchQueryDate(startMonth)}..${this._getMonthEndSearchQueryDate(endMonth)}`, searchQuerySettings);

If I replace my methods with hard-coded dates..

This does work in IE and Edge:

return SearchQueryBuilder.create(`${this.props.searchQuery} CompanyEventDate=7/1/2018..9/30/2018`, searchQuerySettings);

Both are returning, what looks to be, the same querytext. I don't know what the difference is that IE and Edge are seeing.

Has anyone experienced something similar?

Additional Notes

  • I have tried formatting the date differently (using hyphens, 2-digit months and dates). I get the same results (works when hard-coded, but not when returned from method).
  • I am following the network calls in Chrome and IE Dev Tools, and the requests are identical when comparing them in Notepad.
  • Can you also post the snippet of SearchQueryBuilder.create function? The issue could be inside that function – Gautam Sheth Aug 24 '18 at 20:15
  • @GautamSheth That is a part of the PnP-JS-Core library. github.com/SharePoint/PnP-JS-Core/wiki/Working-With:-Search – Jordan Aug 26 '18 at 18:46
  • ok, can you post the _getMonthStartSearchQueryDate method ? Try logging the value of ${this._getMonthStartSearchQueryDate(startMonth)} in console and check if its correct – Gautam Sheth Aug 27 '18 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.