Refactor_Directory And Project Level Permsssion #404
@ -2,7 +2,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { defaultExpense, ExpenseSchema } from "./ExpenseSchema";
|
||||
import { formatFileSize } from "../../utils/appUtils";
|
||||
import { formatFileSize, localToUtc } from "../../utils/appUtils";
|
||||
import { useProjectName } from "../../hooks/useProjects";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { changeMaster } from "../../slices/localVariablesSlice";
|
||||
@ -183,9 +183,8 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
||||
const onSubmit = (fromdata) => {
|
||||
let payload = {
|
||||
...fromdata,
|
||||
transactionDate: moment
|
||||
.utc(fromdata.transactionDate, "DD-MM-YYYY")
|
||||
.toISOString(),
|
||||
transactionDate: localToUtc(fromdata.transactionDate)
|
||||
|
||||
};
|
||||
if (expenseToEdit) {
|
||||
const editPayload = { ...payload, id: data.id };
|
||||
@ -331,7 +330,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
||||
<Label htmlFor="transactionDate" className="form-label" required>
|
||||
Transaction Date
|
||||
</Label>
|
||||
<DatePicker name="transactionDate" control={control} />
|
||||
<DatePicker name="transactionDate" control={control} maxDate={new Date()}/>
|
||||
|
||||
{errors.transactionDate && (
|
||||
<small className="danger-text">
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { format, parseISO } from "date-fns";
|
||||
export const formatFileSize=(bytes)=> {
|
||||
if (bytes < 1024) return bytes + " B";
|
||||
else if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + " KB";
|
||||
@ -68,4 +68,10 @@ export const normalizeAllowedContentTypes = (allowedContentType) => {
|
||||
if (Array.isArray(allowedContentType)) return allowedContentType;
|
||||
if (typeof allowedContentType === "string") return allowedContentType.split(",");
|
||||
return [];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export function localToUtc(localDateString) {
|
||||
const date = new Date(localDateString);
|
||||
return date.toISOString();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user