@drivekyte/date-utils
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -34,2 +34,3 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
const formatDateLong = (date) => dayjs(date).format('ddd MMM DD YYYY'); | ||
const formatISOWithoutTimezone = (date) => dayjs(date).format('YYYY-MM-DDTHH:mm'); | ||
const useDateFormatter = () => ({ | ||
@@ -43,2 +44,3 @@ formatDate, | ||
formatDateLong, | ||
formatISOWithoutTimezone, | ||
}); | ||
@@ -45,0 +47,0 @@ |
@@ -38,2 +38,3 @@ 'use strict'; | ||
const formatDateLong = (date) => dayjs(date).format('ddd MMM DD YYYY'); | ||
const formatISOWithoutTimezone = (date) => dayjs(date).format('YYYY-MM-DDTHH:mm'); | ||
const useDateFormatter = () => ({ | ||
@@ -47,2 +48,3 @@ formatDate, | ||
formatDateLong, | ||
formatISOWithoutTimezone, | ||
}); | ||
@@ -49,0 +51,0 @@ |
@@ -30,2 +30,3 @@ "use strict"; | ||
const formatDateLong = (date) => (0, dayjs_1.default)(date).format('ddd MMM DD YYYY'); | ||
const formatISOWithoutTimezone = (date) => (0, dayjs_1.default)(date).format('YYYY-MM-DDTHH:mm'); | ||
const useDateFormatter = () => ({ | ||
@@ -39,4 +40,5 @@ formatDate, | ||
formatDateLong, | ||
formatISOWithoutTimezone, | ||
}); | ||
exports.default = useDateFormatter; | ||
//# sourceMappingURL=use-date-formatter.js.map |
@@ -60,3 +60,9 @@ "use strict"; | ||
}); | ||
describe('formatISOWithoutTimezone', () => { | ||
it('should format correctly', () => { | ||
const { result } = (0, react_hooks_1.renderHook)(() => (0, use_date_formatter_1.default)()); | ||
expect(result.current.formatISOWithoutTimezone(date)).toEqual('2020-01-01T11:00'); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=use-date-formatter.test.js.map |
@@ -15,3 +15,4 @@ import { Dayjs } from 'dayjs'; | ||
formatDateLong: (date: Dayjs | Date) => string; | ||
formatISOWithoutTimezone: (date: Date) => string; | ||
}; | ||
export default useDateFormatter; |
{ | ||
"name": "@drivekyte/date-utils", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "", | ||
@@ -47,3 +47,3 @@ "keywords": [], | ||
"@testing-library/react-hooks": "^7.0.1", | ||
"@types/jest": "^26.0.24", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "^16.6.2", | ||
@@ -56,3 +56,3 @@ "audit-ci": "^3.1.1", | ||
"husky": "^4.3.8", | ||
"jest": "^26.0.24", | ||
"jest": "^27.3.1", | ||
"jest-config": "^27.0.6", | ||
@@ -77,2 +77,5 @@ "lint-staged": "^10.5.3", | ||
}, | ||
"resolutions": { | ||
"ansi-regex": "5.0.1" | ||
}, | ||
"husky": { | ||
@@ -79,0 +82,0 @@ "hooks": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
137213
530