From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 7 Aug 2022 04:19:06 +0000 (-0700) Subject: simplify date value format X-Git-Tag: v1.9.0-beta.rc1~27^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7396e4c32666ad2acfcfb1343672b988741249ab;p=thirdparty%2Fpaperless-ngx.git simplify date value format --- diff --git a/src-ui/src/app/components/common/input/date/date.component.ts b/src-ui/src/app/components/common/input/date/date.component.ts index cf475df5e2..63a15709b7 100644 --- a/src-ui/src/app/components/common/input/date/date.component.ts +++ b/src-ui/src/app/components/common/input/date/date.component.ts @@ -53,17 +53,11 @@ export class DateComponent } onSuggestionClick(dateString: string) { - const parsedNgDate = this.ngbDateParserFormatter.parse(dateString) - this.writeValue(this.formatDateAsYYYYMMDD(parsedNgDate)) + const parsedDate = this.ngbDateParserFormatter.parse(dateString) + this.writeValue(`${parsedDate.year}-${parsedDate.month}-${parsedDate.day}`) this.onChange(this.value) } - formatDateAsYYYYMMDD(date: NgbDateStruct) { - const monthPrefix = date.month > 9 ? '' : '0' - const dayPrefix = date.day > 9 ? '' : '0' - return `${date.year}-${monthPrefix}${date.month}-${dayPrefix}${date.day}` - } - ngOnInit(): void { super.ngOnInit() this.placeholder = this.settings.getLocalizedDateInputFormat()