mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
sends a date as yyyy-mm-dd
This commit is contained in:
parent
7c4a6781d6
commit
e16cd061f2
@ -67,11 +67,10 @@ export const FormInput = <TFieldValues extends FieldValues, TInputType>({ id, re
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
if (type === 'date') {
|
if (type === 'date') {
|
||||||
const date: Date = new Date(value + 'T00:00:00');
|
if (Number.isNaN(value) && nullable) {
|
||||||
if (Number.isNaN(date) && nullable) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return date;
|
return value;
|
||||||
}
|
}
|
||||||
setCharacterCount(value?.length || 0);
|
setCharacterCount(value?.length || 0);
|
||||||
return value;
|
return value;
|
||||||
|
@ -127,7 +127,7 @@ class Orders::OrderService
|
|||||||
def filter_by_period(orders, filters)
|
def filter_by_period(orders, filters)
|
||||||
return orders unless filters[:period_from].present? && filters[:period_to].present?
|
return orders unless filters[:period_from].present? && filters[:period_to].present?
|
||||||
|
|
||||||
orders.where(created_at: Time.zone.parse(filters[:period_from])..Time.zone.parse(filters[:period_to]).end_of_day)
|
orders.where(created_at: Date.parse(filters[:period_from]).in_time_zone..Date.parse(filters[:period_to]).in_time_zone.end_of_day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def orders_ordering(orders, filters)
|
def orders_ordering(orders, filters)
|
||||||
|
@ -146,10 +146,9 @@ class PaymentScheduleService
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
unless filters[:date].nil?
|
unless filters[:date].nil?
|
||||||
ps = ps.where(
|
start_at = Date.parse(filters[:date]).in_time_zone
|
||||||
"date_trunc('day', payment_schedules.created_at) = :search OR date_trunc('day', payment_schedule_items.due_date) = :search",
|
end_at = start_at.end_of_day
|
||||||
search: "%#{Time.zone.iso8601(filters[:date]).to_date}%"
|
ps = ps.where("(payment_schedules.created_at BETWEEN :start_at AND :end_at) OR (payment_schedule_items.due_date BETWEEN :start_at AND :end_at)", start_at: start_at, end_at: end_at).references(:payment_schedule_items)
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ps
|
ps
|
||||||
|
Loading…
Reference in New Issue
Block a user