Skip to content

Commit

Permalink
Merge branch 'alpha' into merge-alph-to-master
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Jan 10, 2024
2 parents 3e347df + b9450f3 commit 35cf9f4
Show file tree
Hide file tree
Showing 71 changed files with 6,269 additions and 786 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .github/workflows/dhis2-verify-commits.yml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:

lint-commits:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip commit-lint]') }}
steps:
- uses: actions/checkout@v2
with:
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,35 @@

* parse date correctly when a dhis2 calendar type is passed ([#22](https://github.com/dhis2/multi-calendar-dates/issues/22)) ([08c8032](https://github.com/dhis2/multi-calendar-dates/commit/08c8032e5dc32ad9f6f2810ecd7b9cb594766d36))

# [1.0.0-alpha.22](https://github.com/dhis2/multi-calendar-dates/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2023-03-06)


### Bug Fixes

* **generate daily fixed periods:** use correct comparison for "endsBefore" ([#21](https://github.com/dhis2/multi-calendar-dates/issues/21)) ([3cdb2be](https://github.com/dhis2/multi-calendar-dates/commit/3cdb2be65c4faff2462ef8df1984c3f945f8cd22))

# [1.0.0-alpha.21](https://github.com/dhis2/multi-calendar-dates/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2023-03-02)


### Features

* add getSiblingFixedPeriods ([#15](https://github.com/dhis2/multi-calendar-dates/issues/15)) ([59cb406](https://github.com/dhis2/multi-calendar-dates/commit/59cb40642f23b70717430a3a9bce95bcb2e3e584))

# [1.0.0-alpha.20](https://github.com/dhis2/multi-calendar-dates/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2023-03-02)


### Features

* add getFixedPeriodByDate ([#14](https://github.com/dhis2/multi-calendar-dates/issues/14)) ([9de82e0](https://github.com/dhis2/multi-calendar-dates/commit/9de82e027a00766f41413b37bb07767fed049c53))

# [1.0.0-alpha.19](https://github.com/dhis2/multi-calendar-dates/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2023-03-01)


### Features

* **generate fixed periods:** add "endsBefore" option ([#20](https://github.com/dhis2/multi-calendar-dates/issues/20)) ([6667c97](https://github.com/dhis2/multi-calendar-dates/commit/6667c9760df86f592f6c094eb77f4e5c02cfc8c9))
* add createFixedPeriodFromPeriodId method ([#13](https://github.com/dhis2/multi-calendar-dates/issues/13)) ([ef1132e](https://github.com/dhis2/multi-calendar-dates/commit/ef1132e9a7abc2112d5ae94a365d0ed8ae21e9b8))

# 1.0.0 (2023-02-23)


Expand Down
11 changes: 5 additions & 6 deletions features/support/ethiopicCalendar.steps.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import assert from 'assert'
import { When, Then } from '@cucumber/cucumber'
import generateFixedPeriods, {
PeriodIdentifier,
} from '../../src/period-calculation/fixed-periods'
import { generateFixedPeriods } from '../../src/index'
import { PeriodType } from '../../src/period-calculation/types'
import { SupportedCalendar } from '../../src/types'

interface MyWorld {
calendar: SupportedCalendar
year: number
periods: PeriodIdentifier[]
periodType?: PeriodIdentifier
periods: PeriodType[]
periodType?: PeriodType
}
type DataTable = Array<{
year: number
periodCount: number
periodType: PeriodIdentifier
periodType: PeriodType
}>

When(
Expand Down
10 changes: 4 additions & 6 deletions features/support/periodCounts.steps.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import assert from 'assert'
import { Given, When, Then } from '@cucumber/cucumber'
import generateFixedPeriods, {
FixedPeriod,
PeriodIdentifier,
} from '../../src/period-calculation/fixed-periods'
import { generateFixedPeriods } from '../../src/index'
import { FixedPeriod, PeriodType } from '../../src/period-calculation/types'
import { SupportedCalendar } from '../../src/types'

type DataTable = {
year: string
periodType: PeriodIdentifier
periodType: PeriodType
periodCount: number
}

Expand All @@ -17,7 +15,7 @@ type MyWorld = {
year: number
locale: string
results: Array<DataTable & { generatedPeriods: FixedPeriod[] }>
periodType: PeriodIdentifier
periodType: PeriodType
}

Given(
Expand Down
9 changes: 4 additions & 5 deletions features/support/periodsGenerated.steps.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import assert from 'assert'
import { When, Then } from '@cucumber/cucumber'
import generateFixedPeriods, {
PeriodIdentifier,
} from '../../src/period-calculation/fixed-periods'
import { generateFixedPeriods } from '../../src/index'
import { PeriodType } from '../../src/period-calculation/types'
import { SupportedCalendar } from '../../src/types'

type DataTable = {
Expand All @@ -15,13 +14,13 @@ interface MyWorld {
calendar: SupportedCalendar
locale: string
year: number
periodType: PeriodIdentifier
periodType: PeriodType
}

When(
'the user requests {string} periods for {string}',
function (this: MyWorld, periodType: string, year: string) {
this.periodType = periodType?.toUpperCase() as PeriodIdentifier
this.periodType = periodType?.toUpperCase() as PeriodType
this.year = Number(year)
}
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"lint:staged": "yarn lint --staged",
"format": "yarn d2-style apply",
"format:staged": "yarn format --staged",
"cucumber": "NODE_OPTIONS=\"--loader ts-node/esm --no-warnings --experimental-specifier-resolution=node\" cucumber-js --require-module ts-node/register --require **/features/**/*.ts"
"cucumber": "NODE_OPTIONS=\"--loader ts-node/esm --no-warnings --experimental-specifier-resolution=node\" cucumber-js --require-module ts-node/register --require **/features/**/*.ts --tags=\"not @skip\""
},
"eslintConfig": {
"extends": [
Expand Down
9 changes: 7 additions & 2 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import * as lib from './index'

describe('the interface of the library', () => {
it('should have at least these members otherwise it is definitely a breaking change', () => {
expect(Object.keys(lib)).toEqual(
expect.objectContaining([
expect.arrayContaining([
'constants',
'createFixedPeriodFromPeriodId',
'generateFixedPeriods',
'getAdjacentFixedPeriods',
'getFixedPeriodByDate',
'getNowInCalendar',
'periodTypes',
'useDatePicker',
'useResolvedDirection',
'generateFixedPeriods',
])
)

Expand Down
Loading

0 comments on commit 35cf9f4

Please sign in to comment.