Skip to content

Commit fc86a2c

Browse files
committed
Add helper to get the normalized day index on DateTime
1 parent 0cc42fd commit fc86a2c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/datetime-class.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import { MILLISECONDS_PER_WEEK } from './utils/const.js'
22
import { datetime, weekNumber } from './index.js'
3+
import { getNormalizeDay } from './utils/date.js'
34

45
export class DateTime extends Date {
56

7+
/**
8+
* Get the day index of the week, except Sunday is 7 instead of 0.
9+
*
10+
* @returns {number}
11+
*/
12+
getNormalisedDay = () => getNormalizeDay(this)
13+
614
/**
715
* Returns the week of the year (`1`–`53`) of the specified date according to
816
* local time, as defined by the WHATWG and the ISO-8601 specs:

src/datetime-class.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ describe('DateTime class', () => {
4545
})
4646
})
4747

48+
describe.todo('.getNormalisedDay()', () => {})
49+
4850
describe('.getWeek()', () => {
4951

5052
test('returns the week number', () => {

0 commit comments

Comments
 (0)