Skip to content

Commit

Permalink
docs: add dev docs for "createFixedPeriodFromPeriodId"
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Jan 9, 2024
1 parent 4dd3f25 commit c7127c2
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions doc/usage/createFixedPeriodFromPeriodId.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# `createFixedPeriodFromPeriodId`

* [API](#createFixedPeriodFromPeriodId-api)
* [Examples](#createFixedPeriodFromPeriodId-examples)

<a name="createFixedPeriodFromPeriodId-api"></a>
## API

### Signature

```ts
type ParseFixedPeriodId = (args: {
periodId: string
calendar: SupportedCalendar
locale?: string
}) => FixedPeriod
```
### Arguments
| Option | Required | Default value | Description |
|-|-|-|-|
| `periodId` | yes | - | A period id, e.g. `2020` or `2020April` |
| `calendar` | yes | - | A calendar sytem, e.g. `gregory` or `ethiopic` |
| `locale` | no | `"en"` | A language locale for the displayed labels |
### Return value
Returns a fixed period, see `src/period-calculation/types.ts`
<a name="createFixedPeriodFromPeriodId-examples"></a>
## Examples
```ts
createFixedPeriodFromPeriodId({
periodId: '2023',
calendar: 'gregory',
})
```
will return:
```ts
{
periodType: 'YEARLY',
name: '2023',
displayName: '2023',
id: '2023',
iso: '2023',
startDate: '2023-01-01',
endDate: '2023-12-31',
}
```

0 comments on commit c7127c2

Please sign in to comment.