yearMonth split into year + month

This commit is contained in:
2024-01-09 15:43:01 +01:00
parent 90edcf14e1
commit 46b65711a8
12 changed files with 73 additions and 88 deletions

View File

@@ -10,14 +10,16 @@ import { gotoHome } from "../lib/actions/billActions";
export interface LocationEditFormProps {
/** location which should be edited */
location?: BillingLocation,
/** year month at a new billing location should be assigned */
yearMonth?: string
/** year at a new billing location should be assigned */
year?: string
/** month at a new billing location should be assigned */
month?: string
}
export const LocationEditForm:FC<LocationEditFormProps> = ({ location, yearMonth }) =>
export const LocationEditForm:FC<LocationEditFormProps> = ({ location, year, month }) =>
{
const initialState = { message: null, errors: {} };
const handleAction = updateOrAddLocation.bind(null, location?._id, yearMonth);
const handleAction = updateOrAddLocation.bind(null, location?._id, year, month);
const [ state, dispatch ] = useFormState(handleAction, initialState);
// redirect to the main page