@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
package/dist/sdk.esm.js
CHANGED
|
@@ -1098,19 +1098,27 @@ function _getAddressData() {
|
|
|
1098
1098
|
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Calculate someone's age from a date of birth.
|
|
1101
|
-
* @param date YYYY-MM-DD
|
|
1102
1101
|
*/
|
|
1103
1102
|
function calculateAge(date) {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
var age = today.getFullYear() - birthDate.getFullYear();
|
|
1107
|
-
var m = today.getMonth() - birthDate.getMonth();
|
|
1108
|
-
|
|
1109
|
-
if (m < 0 || m === 0 && today.getDate() < birthDate.getDate()) {
|
|
1110
|
-
return age - 1;
|
|
1103
|
+
if (!date) {
|
|
1104
|
+
return 0;
|
|
1111
1105
|
}
|
|
1112
1106
|
|
|
1113
|
-
|
|
1107
|
+
try {
|
|
1108
|
+
var today = new Date();
|
|
1109
|
+
var birthDate = new Date(date);
|
|
1110
|
+
var age = today.getFullYear() - birthDate.getFullYear();
|
|
1111
|
+
var m = today.getMonth() - birthDate.getMonth();
|
|
1112
|
+
|
|
1113
|
+
if (m < 0 || m === 0 && today.getDate() < birthDate.getDate()) {
|
|
1114
|
+
return age - 1;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
return age;
|
|
1118
|
+
} catch (error) {
|
|
1119
|
+
console.error(error);
|
|
1120
|
+
return 0;
|
|
1121
|
+
}
|
|
1114
1122
|
}
|
|
1115
1123
|
|
|
1116
1124
|
function calculateMonthly(_ref) {
|
|
@@ -1220,7 +1228,7 @@ function Button(_ref) {
|
|
|
1220
1228
|
as = _ref.as,
|
|
1221
1229
|
_ref$small = _ref.small,
|
|
1222
1230
|
small = _ref$small === void 0 ? false : _ref$small;
|
|
1223
|
-
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:
|
|
1231
|
+
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';
|
|
1224
1232
|
var statusClass = status === 'primary' && 'bg-teal' || status === 'danger' && 'bg-red-500' || status === 'warning' && 'bg-yellow-400' || status === 'info' && 'bg-blue-400' || 'bg-gray-600';
|
|
1225
1233
|
var classes = (className != null ? className : '') + " " + baseClasses + " " + statusClass;
|
|
1226
1234
|
|