Skip to content

Conversation

BadIdeaException
Copy link
Contributor

Makes the suggested implementation of `createAppointment` correctly handle appointment creations that
cross timezones - e.g. due to Daylight Savings Time.

re: https://forum.exercism.org/t/tests-and-suggested-implementation-for-appointment-time-are-wrong/
Corrects the test so that they respect locales with Daylight Savings Time.

Previously, tests and suggested implementation simply did simple time arithmetic based on the offset
provided to `createAppointment`. This is wrong, as it will shift appointment time-of-day when moving
accross DST boundaries. This changes test implementation so that:
1. correct usage of input times is checked, by passing a 0 offset
2. correct offsetting of appointment time is checked, by passing in a known start date and then
creating one appointment that is within the same DST state and one that is not.

re: https://forum.exercism.org/t/tests-and-suggested-implementation-for-appointment-time-are-wrong/
Copy link
Contributor

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

Copy link
Contributor

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@github-actions github-actions bot closed this Sep 24, 2025
@Cool-Katt Cool-Katt reopened this Sep 24, 2025
@BadIdeaException
Copy link
Contributor Author

Sorry, I had forgotten to update hints and contributors.

@Cool-Katt

This comment was marked as off-topic.

@Cool-Katt
Copy link
Contributor

༼ つ ◕_◕ ༽つ /format

This comment was marked as outdated.

@Cool-Katt

This comment was marked as outdated.

This comment was marked as duplicate.

@BadIdeaException
Copy link
Contributor Author

I ran corepack pnpm install, then corepack pnpm node scripts/format.mjs, but I'm getting an error:

vagrant@exercism-track-javascript:/vagrant$ corepack pnpm node scripts/format.mjs
/vagrant
/vagrant/node_modules/.pnpm/[email protected]/node_modules/prettier

[format] corepack pnpm dlx [email protected]/node_modules/prettier --write "**/*.{js,jsx,cjs,mjs,ts,tsx,css,sass,scss,html,json,md,yml}"
.../19980172966-340                      |  WARN  Installing a dependency from a non-existent directory: /home/vagrant/.cache/pnpm/dlx/neavhuhbszfrs6ovixsvauyx5e/19980172966-340/3.6.2/node_modules/prettier
Already up to date
 ENOENT  ENOENT: no such file or directory, open '/home/vagrant/.cache/pnpm/dlx/neavhuhbszfrs6ovixsvauyx5e/19980172966-340/node_modules/prettier/package.json'

Deleted both node_modules and ~/.cache/pnpm and tried again, but that didn't help.

This comment was marked as duplicate.

@Cool-Katt
Copy link
Contributor

I don't think I've had this error happen to me before. I'm assuming your Node version is current enough (we use LTS, which is 22.20.0 currently). Try reinstalling the dependencies (remove package-lock.json as well and rerun corepack pnpm install).

Of course, I also have to ask, did you check that the directory that it's complaining about really exists?

@BadIdeaException
Copy link
Contributor Author

I got tired of trying to figure this out pretty quick and ended up running prettier by hand. Personally, I think it made it worse instead of better, but at least checks should be passing now.

@SleeplessByte
Copy link
Member

I'll run prettier afterwards.

@SleeplessByte
Copy link
Member

A whole two spaces...

@SleeplessByte SleeplessByte merged commit a5bd153 into exercism:main Sep 29, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests and suggested implementation for Appointment Time are wrong
3 participants