We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
format(date, 'day')
1 parent 48b0aea commit eaca635Copy full SHA for eaca635
.changeset/two-doodles-return.md
@@ -0,0 +1,5 @@
1
+---
2
+'@layerstack/utils': patch
3
4
+
5
+feat(format): Support passing PeriodTypeCode strings to easily format dates (ex. `format(date, 'day')`)
packages/utils/src/lib/array.test.ts
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { greatestAbs, sumObjects } from './array.js';
-import { testDate } from './date.test.js';
+import { testDateStr } from './date.test.js';
6
describe('sumObjects', () => {
7
it('Sum array of objects ', () => {
@@ -11,7 +11,7 @@ describe('sumObjects', () => {
11
{ one: null, two: null, three: null, four: null },
12
{ one: NaN, two: NaN, three: NaN, four: NaN },
13
{ one: 'NaN', two: 'NaN', three: 'NaN', four: 'NaN' },
14
- { one: '3', two: 6, four: '4', startDate: new Date(testDate) },
+ { one: '3', two: 6, four: '4', startDate: new Date(testDateStr) },
15
];
16
17
const actual = sumObjects(values);
@@ -21,7 +21,7 @@ describe('sumObjects', () => {
21
three: 9,
22
four: 4,
23
extra: 0,
24
- startDate: +new Date(testDate),
+ startDate: +new Date(testDateStr),
25
};
26
27
expect(actual).toEqual(expected);
0 commit comments