2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 04:56:45 +00:00

Forms refactor (#8876)

- Use dayjs for cleaner code
This commit is contained in:
Oliver 2025-01-12 08:18:42 +11:00 committed by GitHub
parent 000419255a
commit 7eac3d7d42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ import {
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'; import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
import { Suspense, useEffect, useMemo, useState } from 'react'; import { Suspense, useEffect, useMemo, useState } from 'react';
import dayjs from 'dayjs';
import { api } from '../App'; import { api } from '../App';
import { ActionButton } from '../components/buttons/ActionButton'; import { ActionButton } from '../components/buttons/ActionButton';
import RemoveRowButton from '../components/buttons/RemoveRowButton'; import RemoveRowButton from '../components/buttons/RemoveRowButton';
@ -114,11 +115,7 @@ export function useStockFields({
if (expiry_days && expiry_days > 0) { if (expiry_days && expiry_days > 0) {
// Adjust the expiry date based on the part default expiry // Adjust the expiry date based on the part default expiry
setExpiryDate( setExpiryDate(dayjs().add(expiry_days, 'days').toISOString());
new Date(
new Date().getTime() + expiry_days * 24 * 60 * 60 * 1000
).toISOString()
);
} }
} }
}, },