Skip to content

Commit 4f1f861

Browse files
committed
Update doc
1 parent cb768ad commit 4f1f861

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Compare with [last published version](https://github.com/meduzen/datetime-attrib
1010

1111
### Fixed
1212

13-
- Fix incorrect year for `datetime(date, 'week')` when the week started the previous year. For example, `2021-01-01` is a Friday and its week belongs to 2020 (as [per spec](./README.md#weeknumber). In that case, the output was `2021-53` instead of `2020-53`.
13+
- Fix incorrect year for `datetime(date, 'week')` when the week started the previous year. For example, `2021-01-01` is a Friday and its week belongs to 2020 (as [per spec](./README.md#weeknumber)). In that case, the output was `2021-53` instead of `2020-53`.
1414

1515
### Improved
1616

src/datetime.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('datetime', () => {
106106
expect(datetime(january19th, 'week')).toBe('2021-W03')
107107
})
108108

109-
// 1st day of the month is after Thurdsay
109+
// 1st day of the month is after Thurdsay, but it’s not in January
110110
test('week on 2021-03-01 is 2021-W17', () => {
111111
const march1st2021 = new Date(2021, 4, 1)
112112
expect(getNormalizeDay(march1st2021)).toBeGreaterThan(4)

src/utils/date.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function daysBetween(date, furtherDate) {
3535
* @returns {number}
3636
*/
3737
export function weekNumber(date) {
38-
const dayIndex = getNormalizeDay(date) // normalize index because Sunday == 0
38+
const dayIndex = getNormalizeDay(date)
3939

4040
const sameWeekThursday = new Date(date)
4141
sameWeekThursday.setDate(date.getDate() + 4 - dayIndex)
@@ -47,7 +47,7 @@ export function weekNumber(date) {
4747
}
4848

4949
/**
50-
* Get the day index of the week, except Sunday is 7 instead of 0.
50+
* Get the day index of the week, but Sunday is now 7 instead of 0.
5151
*
5252
* @param {Date} date
5353
* @returns {number}

0 commit comments

Comments
 (0)