Skip to content

Commit

Permalink
Merge pull request #45 from telostat/alioguzhan/remove-pdatetime
Browse files Browse the repository at this point in the history
do not export dayjs and make it peer dependency
  • Loading branch information
alioguzhan authored Aug 21, 2023
2 parents d8d93cd + 7810858 commit cf1a6e7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
id: release
with:
command: manifest
release-type: node

- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
[![npm](https://img.shields.io/npm/dm/@telostat/prelude.svg)](https://www.npmjs.com/package/@telostat/prelude)
![GitHub](https://img.shields.io/github/license/telostat/typescript-prelude)

## Installation

```sh
npm install dayjs @telostat/prelude
```

> `dayjs` is a peer dependency. You need to install it yourself to use date helpers.
## Development

Quick commands:

- Build the library and documentation:
Expand Down
19 changes: 12 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@
"engines": {
"node": ">=16"
},
"peerDependencies": {
"dayjs": "1^"
},
"dependencies": {
"decimal.js": "^10.4.3",
"purify-ts": "^2.0.1"
},
"devDependencies": {
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.2",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"dayjs": "1.11.9",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard": "^17.1.0",
Expand Down Expand Up @@ -71,10 +79,5 @@
"extends": [
"@commitlint/config-conventional"
]
},
"dependencies": {
"dayjs": "^1.11.8",
"decimal.js": "^10.4.3",
"purify-ts": "^2.0.1"
}
}
8 changes: 1 addition & 7 deletions src/-temporal.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import dayjs from 'dayjs';
import { getLastWeekday, getPivotDate, getToday, isoFormatDate, PDateTime, PivotDate } from './-temporal';

describe('PDateTime is dayjs', () => {
test('today is today', () => {
expect(PDateTime().format('YYYY-MM-DD')).toBe(new Date().toISOString().slice(0, 10));
});
});
import { getLastWeekday, getPivotDate, getToday, isoFormatDate, PivotDate } from './-temporal';

describe('PivotDate queries', () => {
const asofDjs = dayjs('2022-07-15');
Expand Down
5 changes: 1 addition & 4 deletions src/-temporal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ dayjs.extend(relativeTime);
dayjs.extend(timezone);
dayjs.extend(utc);

// TODO: Check how we can export Day.js type and functionality.
export const PDateTime = dayjs;

/**
* Type alias for ISO-formatted date values as strings.
*/
Expand All @@ -49,7 +46,7 @@ export interface SDateRange {
/**
* ISO date/time format used in the library.
*/
export const isoFormatDateTime = 'YYYY-MM-DDTHH:MM:SS';
export const isoFormatDateTime = 'YYYY-MM-DDTHH:MM:ss';

/**
* ISO date format used in the library.
Expand Down

0 comments on commit cf1a6e7

Please sign in to comment.