trithuc-mvc-react 3.0.4 → 3.0.5

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.
@@ -60,7 +60,22 @@ export const FilterGod = ({ tableName, filters, elementSize = "small", setPage =
60
60
  };
61
61
 
62
62
  const handleDateChange = (newValue, fieldKey, compareKey, compareType) => {
63
- const formattedDate = newValue ? moment(newValue).format("YYYY-MM-DD") : null;
63
+ let formattedDate = null;
64
+
65
+ // Kiểm tra nếu newValue là ngày hợp lệ
66
+ if (!moment(newValue, "DD/MM/YYYY", true).isValid()) {
67
+ return; // Dừng nếu người dùng nhập chưa xong hoặc giá trị không hợp lệ
68
+ }
69
+
70
+ if (newValue) {
71
+ // Xác định thời gian dựa trên fieldKey
72
+ if (fieldKey.toLowerCase().includes("from")) {
73
+ formattedDate = moment(newValue, "DD/MM/YYYY").startOf("day").format("YYYY-MM-DD HH:mm");
74
+ } else if (fieldKey.toLowerCase().includes("to")) {
75
+ formattedDate = moment(newValue, "DD/MM/YYYY").endOf("day").format("YYYY-MM-DD HH:mm");
76
+ }
77
+ }
78
+
64
79
  const compareDate = dataSearch?.[compareKey] ? moment(dataSearch?.[compareKey]) : null;
65
80
 
66
81
  if (formattedDate && compareDate) {
@@ -92,6 +107,7 @@ export const FilterGod = ({ tableName, filters, elementSize = "small", setPage =
92
107
  <DatePicker
93
108
  label={label}
94
109
  format="DD/MM/YYYY"
110
+ desktopModeMediaQuery="@media (min-width: 0px)"
95
111
  views={["year", "month", "day"]}
96
112
  mask="__/__/____"
97
113
  minDate={
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"