Skip to content

Commit

Permalink
fix the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SebinSong committed Aug 20, 2024
1 parent d8fd80a commit bb6bb10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/views/containers/payments/PaymentsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const PaymentsMixin: Object = {
'dueDateForPeriod',
'groupPeriodPayments',
'groupSettings',
'groupCreatedDate',
'groupSortedPeriodKeys',
'ourIdentityContractId',
'ourPayments',
Expand All @@ -37,11 +38,15 @@ const PaymentsMixin: Object = {
async getAllSortedPeriodKeys () {
const currentDate = new Date()
const distributionDate = new Date(this.groupSettings.distributionDate)
const groupCreatedDate = new Date(this.groupCreatedDate)
const historicalPeriodPayments = Object.keys(await this.getHistoricalPeriodPayments()).sort()
const periods = [
...historicalPeriodPayments,
...this.groupSortedPeriodKeys
].filter(period => new Date(period) <= currentDate) // show only started periods
].filter(period => {
const dPeriod = new Date(period)
return dPeriod > new Date(groupCreatedDate) && dPeriod <= currentDate // show only started periods & filter out the 'waiting' period
})
// remove the waiting period from the list. it's useful for the contract but not in the UI
if (periods.length === 1 && new Date(periods[0]) < distributionDate) {
return []
Expand Down

0 comments on commit bb6bb10

Please sign in to comment.