Skip to content

Commit 0770f14

Browse files
style: prettier
1 parent 527e290 commit 0770f14

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

exercises/concept/appointment-time/.docs/hints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- You need to create a new date. The introduction elaborates on the different ways.
66
- `Date.now()` gives you current time in milliseconds
7-
- `Date` has several getter methods to get date components - months, hours, etc. - for a given date. `getMinutes`, for instance, returns the minutes component.
7+
- `Date` has several getter methods to get date components - months, hours, etc. - for a given date. `getMinutes`, for instance, returns the minutes component.
88
- Likewise, `Date` has several setter methods to set those components, rolling over into "higher" components if needed. `setMinutes(80)`, for example, will increase the hours component by one and set the minutes component to 20.
99

1010
## 2. Convert a date into a timestamp

exercises/concept/appointment-time/.meta/exemplar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function updateAppointment(timestamp, options) {
7676
export function timeBetween(timestampA, timestampB) {
7777
return Math.round(
7878
(new Date(timestampB).getTime() - new Date(timestampA).getTime()) / 1000,
79-
);
79+
);
8080
}
8181

8282
/**

exercises/concept/appointment-time/appointment-time.spec.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ describe('createAppointment', () => {
3030
const currentTime = Date.UTC(2000, 6, 1, 12, 0, 0, 0);
3131
const expectedTime = currentTime + offset * 24 * 60 * 60 * 1000;
3232

33-
expect(createAppointment(offset, currentTime)).toEqual(new Date(expectedTime));
33+
expect(createAppointment(offset, currentTime)).toEqual(
34+
new Date(expectedTime),
35+
);
3436
});
3537

3638
test('creates appointment with potential DST change', () => {
@@ -39,9 +41,15 @@ describe('createAppointment', () => {
3941
const currentTime = Date.UTC(2000, 6, 1, 12, 0, 0, 0);
4042
let expectedTime = currentTime + offset * 24 * 60 * 60 * 1000;
4143
// Manually adjust for DST timezone offset:
42-
expectedTime += (new Date(expectedTime).getTimezoneOffset() - new Date(currentTime).getTimezoneOffset()) * 60 * 1000;
43-
44-
expect(createAppointment(offset, currentTime)).toEqual(new Date(expectedTime));
44+
expectedTime +=
45+
(new Date(expectedTime).getTimezoneOffset() -
46+
new Date(currentTime).getTimezoneOffset()) *
47+
60 *
48+
1000;
49+
50+
expect(createAppointment(offset, currentTime)).toEqual(
51+
new Date(expectedTime),
52+
);
4553
});
4654

4755
test('rolls over days, months, and years', () => {

0 commit comments

Comments
 (0)