mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
fix(server): date format of filtering transactions by date range
This commit is contained in:
@@ -59,15 +59,9 @@ export default class AccountTransaction extends TenantModel {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
filterDateRange(query, startDate, endDate, type = 'day') {
|
filterDateRange(query, startDate, endDate, type = 'day') {
|
||||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
const dateFormat = 'YYYY-MM-DD';
|
||||||
const fromDate = moment(startDate)
|
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
||||||
.utcOffset(0)
|
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
||||||
.startOf(type)
|
|
||||||
.format(dateFormat);
|
|
||||||
const toDate = moment(endDate)
|
|
||||||
.utcOffset(0)
|
|
||||||
.endOf(type)
|
|
||||||
.format(dateFormat);
|
|
||||||
|
|
||||||
if (startDate) {
|
if (startDate) {
|
||||||
query.where('date', '>=', fromDate);
|
query.where('date', '>=', fromDate);
|
||||||
@@ -111,7 +105,6 @@ export default class AccountTransaction extends TenantModel {
|
|||||||
query.modify('filterDateRange', null, toDate);
|
query.modify('filterDateRange', null, toDate);
|
||||||
query.modify('sumationCreditDebit');
|
query.modify('sumationCreditDebit');
|
||||||
},
|
},
|
||||||
|
|
||||||
contactsOpeningBalance(
|
contactsOpeningBalance(
|
||||||
query,
|
query,
|
||||||
openingDate,
|
openingDate,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default class InventoryCostLotTracker extends TenantModel {
|
|||||||
query.groupBy('item_id');
|
query.groupBy('item_id');
|
||||||
},
|
},
|
||||||
filterDateRange(query, startDate, endDate, type = 'day') {
|
filterDateRange(query, startDate, endDate, type = 'day') {
|
||||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
const dateFormat = 'YYYY-MM-DD';
|
||||||
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
||||||
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default class InventoryTransaction extends TenantModel {
|
|||||||
static get modifiers() {
|
static get modifiers() {
|
||||||
return {
|
return {
|
||||||
filterDateRange(query, startDate, endDate, type = 'day') {
|
filterDateRange(query, startDate, endDate, type = 'day') {
|
||||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
const dateFormat = 'YYYY-MM-DD';
|
||||||
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
||||||
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ export default class SaleInvoice extends mixin(TenantModel, [
|
|||||||
* Filters the invoices between the given date range.
|
* Filters the invoices between the given date range.
|
||||||
*/
|
*/
|
||||||
filterDateRange(query, startDate, endDate, type = 'day') {
|
filterDateRange(query, startDate, endDate, type = 'day') {
|
||||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
const dateFormat = 'YYYY-MM-DD';
|
||||||
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
||||||
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
const toDate = moment(endDate).endOf(type).format(dateFormat);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user