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;
|
||||
}
|
||||
if (type === 'date') {
|
||||
const date: Date = new Date(value + 'T00:00:00');
|
||||
if (Number.isNaN(date) && nullable) {
|
||||
if (Number.isNaN(value) && nullable) {
|
||||
return null;
|
||||
}
|
||||
return date;
|
||||
return value;
|
||||
}
|
||||
setCharacterCount(value?.length || 0);
|
||||
return value;
|
||||
|
@ -127,7 +127,7 @@ class Orders::OrderService
|
||||
def filter_by_period(orders, filters)
|
||||
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
|
||||
|
||||
def orders_ordering(orders, filters)
|
||||
|
@ -146,10 +146,9 @@ class PaymentScheduleService
|
||||
)
|
||||
end
|
||||
unless filters[:date].nil?
|
||||
ps = ps.where(
|
||||
"date_trunc('day', payment_schedules.created_at) = :search OR date_trunc('day', payment_schedule_items.due_date) = :search",
|
||||
search: "%#{Time.zone.iso8601(filters[:date]).to_date}%"
|
||||
)
|
||||
start_at = Date.parse(filters[:date]).in_time_zone
|
||||
end_at = start_at.end_of_day
|
||||
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
|
||||
|
||||
ps
|
||||
|
Loading…
Reference in New Issue
Block a user