From 4dbcac4344dda3d647001b5cbc3e74b40542b975 Mon Sep 17 00:00:00 2001 From: Olivier Jacquemart Date: Fri, 26 Nov 2021 16:24:41 +0100 Subject: [PATCH] fix: consider the keepInvalid flag The useStrict flag will also be used if defined to format the date --- src/ng-tempusdominus-bootstrap.directive.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ng-tempusdominus-bootstrap.directive.ts b/src/ng-tempusdominus-bootstrap.directive.ts index fba873b..d10b532 100644 --- a/src/ng-tempusdominus-bootstrap.directive.ts +++ b/src/ng-tempusdominus-bootstrap.directive.ts @@ -151,8 +151,8 @@ export class NgTempusdominusBootstrapInputDirective implements OnInit, OnDestroy if (e.date && e.date !== this.value) { this.value = e.date || null; } else { - const date = _moment(e.target.value, this.options.format); - if (date.isValid()) { + const date = _moment(e.target.value, this.options.format, this.options.useStrict || false); + if (date.isValid() || this.options.keepInvalid) { this.value = date; } }