mirror of
https://github.com/mvvasilev/findtheti.me.git
synced 2025-04-19 13:39:52 +03:00
Fix availability times sometimes not combining correctly
This commit is contained in:
parent
88f924cbb9
commit
150aebb17b
2 changed files with 6 additions and 11 deletions
|
@ -57,7 +57,7 @@ const AvailabilityPicker = (props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteAvailability = (day: AvailabilityDay, time: Dayjs) => {
|
const deleteAvailability = (day: AvailabilityDay, time: Dayjs) => {
|
||||||
let existingTime = day.availableTimes.findIndex(t => utils.dayjsIsBetweenUnixExclusive(t.fromTime, time, t.toTime));
|
let existingTime = day.availableTimes.findIndex(t => utils.dayjsIsBetweenUnixInclusive(t.fromTime, time, t.toTime));
|
||||||
|
|
||||||
if (existingTime >= 0) {
|
if (existingTime >= 0) {
|
||||||
day.availableTimes.splice(existingTime, 1);
|
day.availableTimes.splice(existingTime, 1);
|
||||||
|
@ -98,8 +98,7 @@ const AvailabilityPicker = (props: {
|
||||||
let newFrom = day.availableTimes[existingTimeContainingFrom].fromTime;
|
let newFrom = day.availableTimes[existingTimeContainingFrom].fromTime;
|
||||||
let newTo = day.availableTimes[existingTimeContainingTo].toTime;
|
let newTo = day.availableTimes[existingTimeContainingTo].toTime;
|
||||||
|
|
||||||
day.availableTimes.splice(existingTimeContainingFrom, 1);
|
day.availableTimes = day.availableTimes.filter((_, i) => i !== existingTimeContainingFrom && i !== existingTimeContainingTo);
|
||||||
day.availableTimes.splice(existingTimeContainingTo, 1);
|
|
||||||
|
|
||||||
day.availableTimes.push({
|
day.availableTimes.push({
|
||||||
fromTime: newFrom,
|
fromTime: newFrom,
|
||||||
|
@ -113,9 +112,7 @@ const AvailabilityPicker = (props: {
|
||||||
|
|
||||||
let newFrom = day.availableTimes[existingTimeContainingFrom].fromTime;
|
let newFrom = day.availableTimes[existingTimeContainingFrom].fromTime;
|
||||||
|
|
||||||
day.availableTimes.splice(existingTimeContainingFrom, 1);
|
day.availableTimes.splice(existingTimeContainingFrom, 1, {
|
||||||
|
|
||||||
day.availableTimes.push({
|
|
||||||
fromTime: newFrom,
|
fromTime: newFrom,
|
||||||
toTime: toTime
|
toTime: toTime
|
||||||
});
|
});
|
||||||
|
@ -127,9 +124,7 @@ const AvailabilityPicker = (props: {
|
||||||
|
|
||||||
let newTo = day.availableTimes[existingTimeContainingTo].toTime;
|
let newTo = day.availableTimes[existingTimeContainingTo].toTime;
|
||||||
|
|
||||||
day.availableTimes.splice(existingTimeContainingTo, 1);
|
day.availableTimes.splice(existingTimeContainingTo, 1, {
|
||||||
|
|
||||||
day.availableTimes.push({
|
|
||||||
fromTime: fromTime,
|
fromTime: fromTime,
|
||||||
toTime: newTo
|
toTime: newTo
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: "https://localhost:8443",
|
target: "http://localhost:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue