@star-insure/sdk 4.1.2 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/calculateAge.d.ts +1 -2
- package/dist/sdk.cjs.development.js +18 -10
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +18 -10
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/common/Button.tsx +2 -2
- package/src/lib/calculateAge.ts +17 -10
|
@@ -1105,19 +1105,27 @@ function _getAddressData() {
|
|
|
1105
1105
|
|
|
1106
1106
|
/**
|
|
1107
1107
|
* Calculate someone's age from a date of birth.
|
|
1108
|
-
* @param date YYYY-MM-DD
|
|
1109
1108
|
*/
|
|
1110
1109
|
function calculateAge(date) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
var age = today.getFullYear() - birthDate.getFullYear();
|
|
1114
|
-
var m = today.getMonth() - birthDate.getMonth();
|
|
1115
|
-
|
|
1116
|
-
if (m < 0 || m === 0 && today.getDate() < birthDate.getDate()) {
|
|
1117
|
-
return age - 1;
|
|
1110
|
+
if (!date) {
|
|
1111
|
+
return 0;
|
|
1118
1112
|
}
|
|
1119
1113
|
|
|
1120
|
-
|
|
1114
|
+
try {
|
|
1115
|
+
var today = new Date();
|
|
1116
|
+
var birthDate = new Date(date);
|
|
1117
|
+
var age = today.getFullYear() - birthDate.getFullYear();
|
|
1118
|
+
var m = today.getMonth() - birthDate.getMonth();
|
|
1119
|
+
|
|
1120
|
+
if (m < 0 || m === 0 && today.getDate() < birthDate.getDate()) {
|
|
1121
|
+
return age - 1;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
return age;
|
|
1125
|
+
} catch (error) {
|
|
1126
|
+
console.error(error);
|
|
1127
|
+
return 0;
|
|
1128
|
+
}
|
|
1121
1129
|
}
|
|
1122
1130
|
|
|
1123
1131
|
function calculateMonthly(_ref) {
|
|
@@ -1227,7 +1235,7 @@ function Button(_ref) {
|
|
|
1227
1235
|
as = _ref.as,
|
|
1228
1236
|
_ref$small = _ref.small,
|
|
1229
1237
|
small = _ref$small === void 0 ? false : _ref$small;
|
|
1230
|
-
var baseClasses = small ? 'font-bold text-sm inline-flex items-center gap-3 justify-center text-white text-center px-3 py-1 rounded min-w-[80px] transition-all hover:
|
|
1238
|
+
var baseClasses = small ? 'font-bold text-sm inline-flex items-center gap-3 justify-center text-white text-center px-3 py-1 rounded min-w-[80px] transition-all hover:brightness-110' : 'font-black inline-flex items-center gap-3 justify-center text-white text-center px-5 py-2 rounded-md min-w-[120px] transition-all hover:brightness-110';
|
|
1231
1239
|
var statusClass = status === 'primary' && 'bg-teal' || status === 'danger' && 'bg-red-500' || status === 'warning' && 'bg-yellow-400' || status === 'info' && 'bg-blue-400' || 'bg-gray-600';
|
|
1232
1240
|
var classes = (className != null ? className : '') + " " + baseClasses + " " + statusClass;
|
|
1233
1241
|
|