npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nsshunt/stsfhirpg

v1.2.50

Published

STS FHIR Postgres (pg) Persistence

Readme

stsfhirpg

Some notes on current date/time testing stuff

Yes — these three are timezone bugs, and the diffs show two different timezone-sensitive code patterns.

For the first and third failures, the shift is exactly Brisbane (+10) versus GitHub UTC:

Local expected:
2025-06-30T14:00:00.000Z
                 +10 hours
= 2025-07-01 00:00 Brisbane

GitHub:
2025-07-01T00:00:00.000Z

Same for the birthdate:

Local:   1974-12-24T14:00:00.000Z
GitHub:  1974-12-25T00:00:00.000Z

That almost certainly means somewhere you're doing something equivalent to:

new Date(year, month, day);

because that constructor means midnight in the machine's local timezone.

On your machine:

TZ = Australia/Brisbane

On GitHub:

TZ = UTC

so you get different instants.

The second failure is even more revealing:

SP_VALUE_LOW

local:  2025-09-18T21:00:00.000Z
CI:     2025-09-18T21:00:00.000Z

The underlying instant is identical.

But:

local SP_STR: 20250919
CI SP_STR:    20250918

That tells me you're almost certainly taking that Date and doing something like:

date.getFullYear();
date.getMonth();
date.getDate();

Those are local-time getters.

At:

2025-09-18T21:00:00Z

Brisbane sees:

2025-09-19 07:00

while GitHub UTC sees:

2025-09-18 21:00

Hence:

Brisbane -> 20250919
GitHub   -> 20250918

So that's definitive.

Immediate way to prove it

Add this temporarily to your GitHub test job:

env:
    TZ: Australia/Brisbane

For example:

jobs:
    test:
        runs-on: ubuntu-latest

        env:
            TZ: Australia/Brisbane

        steps:
            - uses: actions/checkout@v4

            # ...

            - run: yarn test

I expect your remaining three tests will pass.

But I would use that only as confirmation, not the permanent fix.

The real fix

FHIR date specifically has no timezone — it represents a calendar date such as 1974-12-25, not an instant in Brisbane, UTC, New York, etc. (HL7)

So your parser should ideally be deterministic regardless of:

developer machine
GitHub runner
Docker
Kubernetes
production server

If you're converting a FHIR date to a range of instants for database searching, I'd define the range in UTC explicitly.

Instead of:

const low = new Date(year, month - 1, day);

use:

const low = new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));

and:

const high = new Date(Date.UTC(year, month - 1, day, 23, 59, 59, 999));

Then everywhere you extract components from a Date, don't mix in local getters.

Instead of:

date.getFullYear();
date.getMonth();
date.getDate();

use:

date.getUTCFullYear();
date.getUTCMonth();
date.getUTCDate();

For example:

function dateOrdinal(date: Date): number {
    const year = date.getUTCFullYear();
    const month = date.getUTCMonth() + 1;
    const day = date.getUTCDate();

    return year * 10000 + month * 100 + day;
}

Then:

2025-09-18T21:00:00Z

will always become:

20250918

regardless of where the application runs.

However, there's one important semantic question in your second test. Your expected value is:

SP_STR = 20250919
SP_VALUE = 2025-09-18T21:00:00Z

That suggests the original FHIR value probably carried an offset such that the intended calendar date was September 19 even though its UTC instant is September 18.

If so, simply switching everything to getUTCDate() could be wrong for that particular dateTime case.

For FHIR dateTime, when a time is supplied the timezone is significant. (HL7) So ideally:

FHIR date
    -> preserve calendar components directly

FHIR dateTime
    -> preserve supplied timezone/calendar meaning
       AND calculate UTC instant separately

In other words, avoid this general pattern:

string
  ↓
Date
  ↓
extract year/month/day again

because Date throws away the distinction between the original textual timezone and the runtime machine timezone.

A safer model is:

Original:
2025-09-19T00:00:00+03:00

Calendar date:
20250919

Instant:
2025-09-18T21:00:00Z

Those are both correct, and one shouldn't be reconstructed from the other using the server's timezone.

So I'd first set:

TZ: Australia/Brisbane

to prove the diagnosis. Then paste your date parsing function — particularly where you calculate SP_STR, SP_VALUE_LOW/HIGH, and the ordinal — and I can show you exactly which Date calls are environment-dependent and how I'd make the FHIR date handling deterministic.