Skip to content

Commit

Permalink
Add helper to get the normalized day index on DateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
meduzen committed Apr 12, 2024
1 parent 0cc42fd commit fc86a2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/datetime-class.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { MILLISECONDS_PER_WEEK } from './utils/const.js'
import { datetime, weekNumber } from './index.js'
import { getNormalizeDay } from './utils/date.js'

export class DateTime extends Date {

/**
* Get the day index of the week, except Sunday is 7 instead of 0.
*
* @returns {number}
*/
getNormalisedDay = () => getNormalizeDay(this)

/**
* Returns the week of the year (`1`–`53`) of the specified date according to
* local time, as defined by the WHATWG and the ISO-8601 specs:
Expand Down
2 changes: 2 additions & 0 deletions src/datetime-class.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ describe('DateTime class', () => {
})
})

describe.todo('.getNormalisedDay()', () => {})

describe('.getWeek()', () => {

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

0 comments on commit fc86a2c

Please sign in to comment.