1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

force to send a date yyyy-mm-dd and not a time ot avoids time zone pb

This commit is contained in:
Nicolas Florentin 2023-11-23 11:27:58 +01:00
parent 10acf9d3ee
commit f18454bf97
2 changed files with 5 additions and 5 deletions

View File

@ -824,11 +824,12 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
* @param [concat] {boolean} if true, the result will be append to $scope.invoices instead of being affected
*/
const invoiceSearch = function (concat) {
const date = $scope.searchInvoice.date ? $scope.searchInvoice.date.toISOString().slice(0, 10) : null;
Invoice.list({
query: {
number: $scope.searchInvoice.reference,
customer: $scope.searchInvoice.name,
date: $scope.searchInvoice.date,
date,
order_by: $scope.orderInvoice,
page: $scope.page,
size: INVOICES_PER_PAGE

View File

@ -29,10 +29,9 @@ class InvoicesService
)
end
unless filters[:date].nil?
invoices = invoices.where(
"date_trunc('day', invoices.created_at) = :search",
search: "%#{Time.iso8601(filters[:date]).in_time_zone.to_date}%"
)
start_at = Date.parse(filters[:date]).in_time_zone
end_at = start_at.end_of_day
invoices = invoices.where(created_at: (start_at..end_at))
end
invoices