Moment or query not working on Chrome(Mac)

Context

I developed a dashboard app to display data from PostgreSQL for a client. I have this query to list the Year-Month of a column named stage_updated_at in both integer and string formats. I'm using this in two dropdown components as Start Month and End Month, serving as a date range filter restricted to months.

WITH date_bounds AS (
    SELECT 
        MIN(stage_updated_at) AS min_date,
        MAX(stage_updated_at) AS max_date
    FROM 
        opp_updates_view
),
year_months AS (
    SELECT 
        TO_CHAR(date_trunc('month', (min_date + (generate_series(0, 
            ((EXTRACT(year FROM max_date) - EXTRACT(year FROM min_date)) * 12 + 
            (EXTRACT(month FROM max_date) - EXTRACT(month FROM min_date)))::integer, 1) * interval '1 month'))) , 'YYYY-MM') AS stage_updated_month,
        TO_CHAR(date_trunc('month', (min_date + (generate_series(0, 
            ((EXTRACT(year FROM max_date) - EXTRACT(year FROM min_date)) * 12 + 
            (EXTRACT(month FROM max_date) - EXTRACT(month FROM min_date)))::integer, 1) * interval '1 month'))) , 'YYYYMM')::INTEGER AS stage_updated_number
    FROM 
        date_bounds
)
SELECT DISTINCT 
    stage_updated_month,
    stage_updated_number
FROM 
    year_months
ORDER BY 
    stage_updated_month;

I'm using the integer value as the value and the string for the label. The default value is set to "from the previous to the current" with moment().subtract().

Issue

On my browser, which is Chrome on Windows 11, it's working just fine. But on my client's browser, which is also Chrome but on Mac, it's not working properly. It's always like he's in the previous month, with the maximum selectable month being June 2024, and the default start month is two months ago.

I appreciate any pointers.

By the way, my client already tried with the incognito mode.

And I'm not caching the result, either.
image

Hello @Adam_Artemis!

This is a very interesting bug.

Given the fact that it works correctly on your computer but not another, I want to guess that the issue is stemming from moment() but there are a couple things we can look at :thinking:

If you remove moment().subtract(1, 'months') from the Default value, what is the behavior on the two computers?

Other steps to trouble shoot where the issue is coming from would be:

  • Console Logs:

  • Use console.log() to print the values of the dates and the generated dropdown options on both your machine and the client’s machine. This can help identify if there are differences in the data being generated.

  • Check Timezone Settings:

  • Ensure that the time zones on both the server and the client machines are set correctly. Timezone differences can sometimes cause issues with date calculations and display.