This script is only intended to be run on the TimeEntries#index page. Unfortunately, it runs on every page, which results in a lot of queries to the server with the GET parameter date=undefined. By checking that filterDate is truthy (i.e. not undefined or some other not-date things), we should be reasonably confident that the date being sent to the server is probably actually a date.
This script is only intended to be run on the TimeEntries#index page. Unfortunately, it runs on every page, which results in a lot of queries to the server with the GET parameter
date=undefined
. By checking thatfilterDate
is truthy (i.e. notundefined
or some other not-date things), we should be reasonably confident that the date being sent to the server is probably actually a date.