posit-dev / posit-dev/connectapi

fix: timestamp parsing tests think they're changing the timezone but they aren't

Open
#406 0 comments 1 reaction 1 assignee View on GitHub

@toph-allen is already working on this.

Since Jun 10, 2025.

Dominant language
R
Stars
54
Forks
27
Avg merge
1d 3m
Merged PRs (30d)
1

Description

Noticed here: https://github.com/posit-dev/connectapi/pull/405/files#diff-0d56414e1bc981e4745c47aaf583ffd17cc170be5b80ee3ff31bf056e543903aR134

According to ?Sys.timezone, the timezone is detected the first time it is needed and then cached for the rest of the R session. So setting TZ within the R process isn't actually effective.

% R
> Sys.timezone()
[1] "America/New_York"
> options(TZ="UTC")
> Sys.timezone()
[1] "America/New_York"

We missed that in the tests because we were asserting that the strings were being parsed according to Sys.timezone(), and we thought that was changing by setting TZ, but it wasn't.

It's probably not worth doing anything fancier to prove that we set different timezones, so we should probably just delete the duplicate tests that suggest that we can change the timezone and keep the ones that assert that we read in Sys.timezone().

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.