@ltht-react/utils
Advanced tools
Comparing version 0.2.1 to 1.0.0
@@ -6,14 +6,18 @@ # Change Log | ||
## [0.2.1](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.1.20...@ltht-react/utils@0.2.1) (2021-01-22) | ||
## [0.1.20](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.1.18...@ltht-react/utils@0.1.20) (2020-11-19) | ||
**Note:** Version bump only for package @ltht-react/utils | ||
### Reverts | ||
* Revert "refactor components and fix styles" ([b0c5fd8](https://github.com/ltht-epr/ltht-react/commit/b0c5fd89836aa7c47afe96aeccefd955a06dd50b)) | ||
* Revert "Publish" ([833cdd7](https://github.com/ltht-epr/ltht-react/commit/833cdd729f74c9fee22fa55530a6ec5552f438ea)) | ||
## [0.1.19](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.1.18...@ltht-react/utils@0.1.19) (2020-10-29) | ||
**Note:** Version bump only for package @ltht-react/utils | ||
## [0.1.18](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.1.17...@ltht-react/utils@0.1.18) (2020-09-10) | ||
@@ -20,0 +24,0 @@ |
export { default as allergyIntoleranceCategoryCodeDisplaySummary } from './allergy-intolerance-category-code'; | ||
export * from './codeable-concept'; | ||
export { default as metadataSourceSummaryText } from './metadata'; | ||
export { default as partialDateTimeText } from './partial-date-time'; | ||
export * from './partial-date-time'; | ||
export { default as periodSummaryText } from './period'; | ||
@@ -6,0 +6,0 @@ export { default as resourceReferenceDisplaySummary } from './resource-reference'; |
@@ -18,4 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "metadataSourceSummaryText", { enumerable: true, get: function () { return metadata_1.default; } }); | ||
var partial_date_time_1 = require("./partial-date-time"); | ||
Object.defineProperty(exports, "partialDateTimeText", { enumerable: true, get: function () { return partial_date_time_1.default; } }); | ||
__exportStar(require("./partial-date-time"), exports); | ||
var period_1 = require("./period"); | ||
@@ -22,0 +21,0 @@ Object.defineProperty(exports, "periodSummaryText", { enumerable: true, get: function () { return period_1.default; } }); |
import { PartialDateTime } from '@ltht-react/types'; | ||
declare const partialDateTimeText: (partialDateTime?: PartialDateTime | null | undefined) => string; | ||
export default partialDateTimeText; | ||
export declare const formatDate: (date: Date) => string; | ||
export declare const formatTime: (date: Date) => string; | ||
export declare const partialDateTimeText: (partialDateTime?: PartialDateTime | null | undefined) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.partialDateTimeText = exports.formatTime = exports.formatDate = void 0; | ||
var types_1 = require("@ltht-react/types"); | ||
@@ -10,3 +11,3 @@ var locale = 'en-gb'; | ||
var minuteFormat = '2-digit'; | ||
var formatDate = function (date) { | ||
exports.formatDate = function (date) { | ||
return date | ||
@@ -17,3 +18,3 @@ .toLocaleString(locale, { day: dayFormat, month: monthFormat, year: yearFormat }) | ||
}; | ||
var formatTime = function (date) { | ||
exports.formatTime = function (date) { | ||
return date | ||
@@ -24,3 +25,3 @@ .toLocaleString(locale, { hour: hourFormat, minute: minuteFormat, hour12: false }) | ||
}; | ||
var partialDateTimeText = function (partialDateTime) { | ||
exports.partialDateTimeText = function (partialDateTime) { | ||
if (!partialDateTime || !partialDateTime.value) { | ||
@@ -31,6 +32,6 @@ return ''; | ||
case types_1.PartialDateTimeKindCode.Date: | ||
return formatDate(new Date(partialDateTime.value)); | ||
return exports.formatDate(new Date(partialDateTime.value)); | ||
case types_1.PartialDateTimeKindCode.DateTime: { | ||
var date = new Date(partialDateTime.value); | ||
return formatDate(date) + " " + formatTime(date); | ||
return exports.formatDate(date) + " " + exports.formatTime(date); | ||
} | ||
@@ -45,3 +46,3 @@ case types_1.PartialDateTimeKindCode.Year: | ||
case types_1.PartialDateTimeKindCode.Time: | ||
return formatTime(new Date(partialDateTime.value)); | ||
return exports.formatTime(new Date(partialDateTime.value)); | ||
default: | ||
@@ -51,3 +52,2 @@ return ''; | ||
}; | ||
exports.default = partialDateTimeText; | ||
//# sourceMappingURL=partial-date-time.js.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var types_1 = require("@ltht-react/types"); | ||
var partial_date_time_1 = __importDefault(require("./partial-date-time")); | ||
var partial_date_time_1 = require("./partial-date-time"); | ||
describe('partialDateTimeText', function () { | ||
@@ -19,11 +16,11 @@ // it('formats date correctly', () => { | ||
var date = partialDateTime(types_1.PartialDateTimeKindCode.Time); | ||
expect(partial_date_time_1.default(date)).toEqual('13:15'); | ||
expect(partial_date_time_1.partialDateTimeText(date)).toEqual('13:15'); | ||
}); | ||
it('formats year correctly', function () { | ||
var date = partialDateTime(types_1.PartialDateTimeKindCode.Year); | ||
expect(partial_date_time_1.default(date)).toEqual('2013'); | ||
expect(partial_date_time_1.partialDateTimeText(date)).toEqual('2013'); | ||
}); | ||
it('formats year-month correctly', function () { | ||
var date = partialDateTime(types_1.PartialDateTimeKindCode.YearMonth); | ||
expect(partial_date_time_1.default(date)).toEqual('Feb-2013'); | ||
expect(partial_date_time_1.partialDateTimeText(date)).toEqual('Feb-2013'); | ||
}); | ||
@@ -30,0 +27,0 @@ }); |
@@ -54,3 +54,3 @@ "use strict"; | ||
if (yearAge === 1) { | ||
return 12 + monthAge + "m" + (dateAge ? " " + dateAge + "d" : ''); | ||
return 12 + monthAge + "m" + (String(dateAge) ? " " + dateAge + "d" : ''); | ||
} | ||
@@ -57,0 +57,0 @@ // Calculate age measured in simple units. |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var partial_date_time_1 = __importDefault(require("./partial-date-time")); | ||
var partial_date_time_1 = require("./partial-date-time"); | ||
var periodSummaryText = function (period) { | ||
var start = ((period === null || period === void 0 ? void 0 : period.start) && partial_date_time_1.default(period === null || period === void 0 ? void 0 : period.start)) || ''; | ||
var end = ((period === null || period === void 0 ? void 0 : period.end) && partial_date_time_1.default(period === null || period === void 0 ? void 0 : period.end)) || ''; | ||
var start = ((period === null || period === void 0 ? void 0 : period.start) && partial_date_time_1.partialDateTimeText(period === null || period === void 0 ? void 0 : period.start)) || ''; | ||
var end = ((period === null || period === void 0 ? void 0 : period.end) && partial_date_time_1.partialDateTimeText(period === null || period === void 0 ? void 0 : period.end)) || ''; | ||
if (start === '' && end === '') | ||
@@ -11,0 +8,0 @@ return ''; |
{ | ||
"name": "@ltht-react/utils", | ||
"version": "0.2.1", | ||
"version": "1.0.0", | ||
"description": "> TODO: description", | ||
@@ -25,5 +25,5 @@ "author": "Jonny Smith <jonny.asmith@gmail.com>", | ||
"dependencies": { | ||
"@ltht-react/types": "^0.1.1" | ||
"@ltht-react/types": "^0.0.27" | ||
}, | ||
"gitHead": "8ed606fa5eb29a987434481dce1c2fed87966fc7" | ||
"gitHead": "ce395cbe99477a620c639ce01b401654510f7f81" | ||
} |
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
93706
1127
+ Added@emotion/core@10.0.35(transitive)
+ Added@ltht-react/types@0.0.27(transitive)
- Removed@emotion/core@10.3.1(transitive)
- Removed@ltht-react/types@0.1.1(transitive)
Updated@ltht-react/types@^0.0.27