mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
fix: Fiscal Year in Jan, Feb, Mar
This commit is contained in:
parent
86f346913b
commit
bb80e2ec3a
@ -67,8 +67,13 @@ module.exports = {
|
|||||||
fieldtype: 'Date',
|
fieldtype: 'Date',
|
||||||
formula: doc => {
|
formula: doc => {
|
||||||
if (!doc.country) return;
|
if (!doc.country) return;
|
||||||
|
let today = DateTime.local();
|
||||||
let fyStart = countryList[doc.country].fiscal_year_start;
|
let fyStart = countryList[doc.country].fiscal_year_start;
|
||||||
return DateTime.fromFormat(fyStart, 'MM-dd').toISODate();
|
return DateTime.fromFormat(fyStart, 'MM-dd')
|
||||||
|
.plus({
|
||||||
|
year: [1, 2, 3].includes(today.month) ? -1 : 0
|
||||||
|
})
|
||||||
|
.toISODate();
|
||||||
},
|
},
|
||||||
required: 1
|
required: 1
|
||||||
},
|
},
|
||||||
@ -80,9 +85,10 @@ module.exports = {
|
|||||||
fieldtype: 'Date',
|
fieldtype: 'Date',
|
||||||
formula: doc => {
|
formula: doc => {
|
||||||
if (!doc.country) return;
|
if (!doc.country) return;
|
||||||
|
let today = DateTime.local();
|
||||||
let fyEnd = countryList[doc.country].fiscal_year_end;
|
let fyEnd = countryList[doc.country].fiscal_year_end;
|
||||||
return DateTime.fromFormat(fyEnd, 'MM-dd')
|
return DateTime.fromFormat(fyEnd, 'MM-dd')
|
||||||
.plus({ year: 1 })
|
.plus({ year: [1, 2, 3].includes(today.month) ? 0 : 1 })
|
||||||
.toISODate();
|
.toISODate();
|
||||||
},
|
},
|
||||||
required: 1
|
required: 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user