From ed9142c84ab147158f6d37a0e366a78b515075e7 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Tue, 7 May 2024 18:30:56 +0300 Subject: [PATCH 1/2] pad month numbers --- .../home/consortium/add-consortium-member.component.ts | 2 +- .../home/consortium/remove-consortium-member.component.ts | 4 +++- ui/src/app/shared/service/date-util.service.ts | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/src/app/home/consortium/add-consortium-member.component.ts b/ui/src/app/home/consortium/add-consortium-member.component.ts index 2ee430641..c50ddb44b 100644 --- a/ui/src/app/home/consortium/add-consortium-member.component.ts +++ b/ui/src/app/home/consortium/add-consortium-member.component.ts @@ -26,7 +26,7 @@ export class AddConsortiumMemberComponent implements OnInit { routeData: any currentMonth: number | undefined currentYear: number | undefined - monthList: [number, string][] | undefined + monthList: [string, string][] | undefined yearList: number[] | undefined editForm: FormGroup = this.fb.group({ orgName: [null, [Validators.required, Validators.maxLength(41)]], diff --git a/ui/src/app/home/consortium/remove-consortium-member.component.ts b/ui/src/app/home/consortium/remove-consortium-member.component.ts index ac276ef56..c692649fb 100644 --- a/ui/src/app/home/consortium/remove-consortium-member.component.ts +++ b/ui/src/app/home/consortium/remove-consortium-member.component.ts @@ -28,7 +28,7 @@ export class RemoveConsortiumMemberComponent implements OnInit, OnDestroy { consortiumMemberId: string | undefined currentMonth: number | undefined currentYear: number | undefined - monthList: [number, string][] | undefined + monthList: [string, string][] | undefined yearList: number[] | undefined editForm: FormGroup = this.fb.group({ terminationMonth: [null, [Validators.required]], @@ -55,6 +55,8 @@ export class RemoveConsortiumMemberComponent implements OnInit, OnDestroy { this.currentMonth = this.dateUtilService.getCurrentMonthNumber() this.currentYear = this.dateUtilService.getCurrentYear() this.monthList = this.dateUtilService.getMonthsList() + console.log(this.monthList) + this.yearList = this.dateUtilService.getFutureYearsIncludingCurrent(1) this.accountService.getAccountData().subscribe((account) => { diff --git a/ui/src/app/shared/service/date-util.service.ts b/ui/src/app/shared/service/date-util.service.ts index 630027b39..12338110e 100644 --- a/ui/src/app/shared/service/date-util.service.ts +++ b/ui/src/app/shared/service/date-util.service.ts @@ -37,22 +37,22 @@ export class DateUtilService { return years } - getMonthsList(): [number, string][] { + getMonthsList(): [string, string][] { const months = moment.months() const monthsArray = [] for (let _i = 1; _i <= months.length; _i++) { - const res: [number, string] = [parseInt(('0' + _i.toString()).slice(-2)), months[_i - 1]] + const res: [string, string] = [('0' + _i.toString()).slice(-2), months[_i - 1]] monthsArray.push(res) } return monthsArray } - getFutureMonthsList(): [number, string][] { + getFutureMonthsList(): [string, string][] { const months = moment.months() const monthsArray = [] for (let _i = 1; _i <= months.length; _i++) { if (_i > this.getCurrentMonthNumber()) { - const res: [number, string] = [parseInt(('0' + _i.toString()).slice(-2)), months[_i - 1]] + const res: [string, string] = [('0' + _i.toString()).slice(-2), months[_i - 1]] monthsArray.push(res) } } From 88a6a1ea145c33116fd44fa090caed094216e07e Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Tue, 7 May 2024 18:31:46 +0300 Subject: [PATCH 2/2] remove log --- ui/src/app/home/consortium/remove-consortium-member.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/src/app/home/consortium/remove-consortium-member.component.ts b/ui/src/app/home/consortium/remove-consortium-member.component.ts index c692649fb..01a45b723 100644 --- a/ui/src/app/home/consortium/remove-consortium-member.component.ts +++ b/ui/src/app/home/consortium/remove-consortium-member.component.ts @@ -55,7 +55,6 @@ export class RemoveConsortiumMemberComponent implements OnInit, OnDestroy { this.currentMonth = this.dateUtilService.getCurrentMonthNumber() this.currentYear = this.dateUtilService.getCurrentYear() this.monthList = this.dateUtilService.getMonthsList() - console.log(this.monthList) this.yearList = this.dateUtilService.getFutureYearsIncludingCurrent(1)