diff --git a/src/common/funcs/optionConvert.ts b/src/common/funcs/optionConvert.ts
index 68f54ac..a945544 100644
--- a/src/common/funcs/optionConvert.ts
+++ b/src/common/funcs/optionConvert.ts
@@ -108,6 +108,45 @@ export function getTextAddress(detailAddress: any, address?: string): string {
return parts.length ? parts.join(", ") : "---";
}
+export const formatDateOfBirth = (value: string) => {
+ const digits = value.replace(/\D/g, "").slice(0, 8);
+ if (digits.length <= 2) return digits;
+ if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
+ return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4)}`;
+};
+
+export const parseDateOfBirth = (value: string) => {
+ const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
+ if (!match) return null;
+
+ const day = Number(match[1]);
+ const month = Number(match[2]);
+ const year = Number(match[3]);
+
+ const parsedDate = new Date(year, month - 1, day);
+
+ if (
+ parsedDate.getFullYear() !== year ||
+ parsedDate.getMonth() !== month - 1 ||
+ parsedDate.getDate() !== day
+ ) {
+ return null;
+ }
+
+ return parsedDate;
+};
+
+export const formatToISODate = (date: Date | null): string => {
+ if (!date) return "";
+
+ const year = date.getFullYear();
+ // Đảm bảo tháng và ngày luôn có 2 chữ số (VD: 02, 12)
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+
+ return `${year}-${month}-${day}`; // Kết quả: "2001-02-12"
+};
+
export function numberToWords(number: number) {
if (typeof number !== "number" || isNaN(number)) {
return "Không hợp lệ";
diff --git a/src/components/page/auth/MainLogin/MainLogin.tsx b/src/components/page/auth/MainLogin/MainLogin.tsx
index 215b899..78e8b9e 100644
--- a/src/components/page/auth/MainLogin/MainLogin.tsx
+++ b/src/components/page/auth/MainLogin/MainLogin.tsx
@@ -78,6 +78,11 @@ export default function MainLogin() {
// Kiểm tra nhanh điều kiện dữ liệu trước khi trigger API
if (!form.username || !form.password) return;
+ // if (form.password.length < 6) {
+ // alert("Mật khẩu phải có ít nhất 6 ký tự");
+ // return;
+ // }
+
if (isRememberPassword) {
store.dispatch(
setDataLoginStorage({
@@ -136,6 +141,7 @@ export default function MainLogin() {
onClean
isRequired
isBlur
+ min={6}
showDone
icon={
CHUYÊN KHOA
- -{selectedSpecialty.specialtyName || "---"}
+ {/* Thêm class để bọc text */} ++ {selectedSpecialty.specialtyName || "---"} +
CHẨN ĐOÁN
- -{selectedSpecialty.diagnosis || "---"}
+ {/* Thêm class để bọc text */} ++ {selectedSpecialty.diagnosis || "---"} +
GHI CHÚ KHÁM
- -{selectedSpecialty.specialtyNotes || "---"}
+ {/* Thêm class để bọc text */} ++ {selectedSpecialty.specialtyNotes || "---"} +
THỦ THUẬT
- -{selectedSpecialty.procedureNotes || "---"}
+ {/* Thêm class để bọc text */} ++ {selectedSpecialty.procedureNotes || "---"} +