Code not working after publishing

It’s different pieces of code, some are not using the database. These are the ones I know right now, and I’m testing the whole site.

I have a zipcode checker. It’s looking at a list of zipcodes, and if the person inputs a zipcode in the database, it sends them to page A. If they input a zipcode not in the database, then it sends them to page B. This no longer works in the published site or the preview site.

import wixData from "wix-data";
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

export function searchzip_click_1(event) {
 let SearchValue = $w("#searchbar").value
    $w("#dataset2").setFilter(wixData.filter().contains('zipCodes', SearchValue))
        .then(() => {
 let count = $w("#dataset2").getTotalCount();
 if (count === 0) {
                wixLocation.to("https://mailchi.mp/surroundins.com/out-of-area");
            } else {
                wixLocation.to("https://mailchi.mp/surroundins.com/in-area");
            }
        })

The second thing not working is today’s date. This does work in the preview site, but not in the published site.
Here’s the tutorial I used. https://www.wix.com/corvid/forum/community-discussion/display-current-year

/ Gets today's date
const today = new Date();
// Sets the property of the text element to be a string representing today's date in the user's local format
$w("#dateText2").text = today.getFullYear().toString();

I suspect there is some underlying issue I’m missing since these pieces of code are so different.

A solution seems to be to test things in an icognito window. If this doesn’t prove true for all the code, I’ll update this post.