feature(Periodisk redovisning): Formulär för periodisk redovisning (TV-771)
Squashed commit of the following: commit eee14a464fe2fe2a99074f0fe92eecfc92cd05fa Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 20 14:09:48 2021 +0200 styling commit b95bac31ac2b33b5c383a32f06ababf3e5f00245 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 20 13:35:03 2021 +0200 Update periodisk-redovisning.validator.ts commit aeda04cd6705e72b5621a3079904617322ce3036 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 20 13:34:15 2021 +0200 Deltagaren har inte deltagit i några aktiviteter denna period checkbox commit f6ee1ff62d5001e8319bfff04ceb6950ebce9cff Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 20 11:12:57 2021 +0200 form validation and dialog done commit 93e5345d13caf5ab25dc581d58efe92f85acb2dd Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 20 09:16:03 2021 +0200 hidden checkboxes commit 68c2f17ec8417ce5a0404d5b0c00e4800b738143 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 20 08:19:01 2021 +0200 Update app.module.ts commit 2a1dfa6559b9b86839de8ddd1d8cd7c821a56b3a Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Oct 19 21:56:22 2021 +0200 form array with checkboxes done commit 32f26800656d13d1c6c30b20c8187b20fda3c71c Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Oct 19 17:04:33 2021 +0200 activity form array commit db2974cfcca453390ebb4f637daf9d9064b527da Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Oct 19 15:56:39 2021 +0200 add radiobuttons commit 2c4099b48337aaad1cb5b0cc4794ee94e6bb508c Merge: 1ae24a9025b12092Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Oct 19 14:07:46 2021 +0200 Merge branch 'develop' into feature/TV-771-periodisk-redovisning commit 1ae24a905a6c915dcc7d5e3b0cf77a8b62b44d7c Merge: 79e0cf39 794bbc9a Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Oct 19 10:14:29 2021 +0200 Merge branch 'feature/TV-771-periodisk-redovisning' of ssh://bitbucket.arbetsformedlingen.se:7999/tea/mina-sidor-fa-web into feature/TV-771-periodisk-redovisning commit 79e0cf394055527ba09f0d1ae97ddc7c519f2236 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Oct 19 10:14:18 2021 +0200 Updated periods commit 794bbc9a71a0e638196d961ed8b3093de5a64e49 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Oct 19 09:30:24 2021 +0200 Update package-lock.json commit 56351afb1f92060b9f743233a69a785114a3ee96 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Mon Oct 18 17:03:19 2021 +0200 Update periodisk-redovisning-form.component.ts commit 213e6c888a8e388381cf4370d2f5020987b29c4f Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Mon Oct 18 17:01:17 2021 +0200 Update extract-avrop-periods.ts commit 4bcd9669b70070654111f650e6b20d8d8981b3a1 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Mon Oct 18 17:00:47 2021 +0200 avrop periods commit cee788517c34107a2f651313038c343bb4fc702e Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Mon Oct 18 15:46:48 2021 +0200 clean up commit 3d1d2414270a0de1111ba8b16194dc82ec5bbe79 Merge: b6304eed9104fc31Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Mon Oct 18 15:37:08 2021 +0200 Merge branch 'develop' into feature/periodisk-redovisning commit b6304eedf683ba9679e38628d9d3cc33c07103a7 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Fri Oct 15 14:37:59 2021 +0200 Added testdata to test around with inside the component commit d036a771e9139ed6523f71078fa0cb76b936c88b Merge: cb2198415d2f63b9Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Fri Oct 15 14:03:25 2021 +0200 Merge branch 'develop' into feature/periodisk-redovisning ... and 3 more commits
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
import { DateFormatOptions } from '@msfa-models/date-format-options.model';
|
||||
|
||||
// Takes either 6 or 8 characters string (YYYYMMDD) and formats it to ISO standard (YYYY-MM-DD).
|
||||
export function formatToIsoString(date: string): string {
|
||||
if (date.length === 6) {
|
||||
return `${date.substring(0, 4)}-${date.substring(4)}`;
|
||||
} else if (date.length === 8) {
|
||||
return `${date.substring(0, 4)}-${date.substring(4, 6)}-${date.substring(6)}`;
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
export function formatToDate(date: string): Date {
|
||||
const year = date.substring(0, 4);
|
||||
const month = date.substring(4, 6) || '01';
|
||||
@@ -19,8 +8,8 @@ export function formatToDate(date: string): Date {
|
||||
return new Date(`${year}-${month}-${day}`);
|
||||
}
|
||||
|
||||
export function dateToIsoString(date: Date, locale: string = 'sv-SE'): string {
|
||||
const formatOptions: DateFormatOptions = {
|
||||
export function formatDate(date: Date, locale: string = 'sv-SE', options?: DateFormatOptions): string {
|
||||
const formatOptions: DateFormatOptions = options || {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric',
|
||||
|
||||
@@ -4,7 +4,11 @@ import { ValidationError } from '@msfa-models/validation-error.model';
|
||||
export function RequiredValidator(message = 'Fältet är obligatoriskt'): ValidatorFn {
|
||||
return (control: AbstractControl): ValidationError => {
|
||||
if (control) {
|
||||
if (!control.value || (Array.isArray(control.value) && !control.value.length)) {
|
||||
if (
|
||||
control.value === null ||
|
||||
control.value === undefined ||
|
||||
(Array.isArray(control.value) && !control.value.length)
|
||||
) {
|
||||
return { required: message };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user