@@ -4,9 +4,9 @@ import type {TranslationPaths} from '@src/languages/types';
44import type ONYXKEYS from '@src/ONYXKEYS' ;
55import type { InputID } from '@src/types/form/WorkspaceReportFieldForm' ;
66import type { PolicyReportField , PolicyReportFieldType } from '@src/types/onyx/Policy' ;
7- import * as ErrorUtils from './ErrorUtils' ;
8- import * as Localize from './Localize' ;
9- import * as ValidationUtils from './ValidationUtils' ;
7+ import { addErrorMessage } from './ErrorUtils' ;
8+ import { translateLocal } from './Localize' ;
9+ import { isRequiredFulfilled } from './ValidationUtils' ;
1010
1111/**
1212 * Gets the translation key for the report field type.
@@ -45,17 +45,13 @@ function validateReportFieldListValueName(
4545) : FormInputErrors < typeof ONYXKEYS . FORMS . WORKSPACE_REPORT_FIELDS_FORM > {
4646 const errors : FormInputErrors < typeof ONYXKEYS . FORMS . WORKSPACE_REPORT_FIELDS_FORM > = { } ;
4747
48- if ( ! ValidationUtils . isRequiredFulfilled ( valueName ) ) {
49- errors [ inputID ] = Localize . translateLocal ( 'workspace.reportFields.listValueRequiredError' ) ;
48+ if ( ! isRequiredFulfilled ( valueName ) ) {
49+ errors [ inputID ] = translateLocal ( 'workspace.reportFields.listValueRequiredError' ) ;
5050 } else if ( priorValueName !== valueName && listValues . some ( ( currentValueName ) => currentValueName === valueName ) ) {
51- errors [ inputID ] = Localize . translateLocal ( 'workspace.reportFields.existingListValueError' ) ;
51+ errors [ inputID ] = translateLocal ( 'workspace.reportFields.existingListValueError' ) ;
5252 } else if ( [ ...valueName ] . length > CONST . WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH ) {
5353 // Uses the spread syntax to count the number of Unicode code points instead of the number of UTF-16 code units.
54- ErrorUtils . addErrorMessage (
55- errors ,
56- inputID ,
57- Localize . translateLocal ( 'common.error.characterLimitExceedCounter' , { length : [ ...valueName ] . length , limit : CONST . WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH } ) ,
58- ) ;
54+ addErrorMessage ( errors , inputID , translateLocal ( 'common.error.characterLimitExceedCounter' , { length : [ ...valueName ] . length , limit : CONST . WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH } ) ) ;
5955 }
6056
6157 return errors ;
@@ -80,7 +76,7 @@ function getReportFieldInitialValue(reportField: PolicyReportField | null): stri
8076 }
8177
8278 if ( reportField . type === CONST . REPORT_FIELD_TYPES . DATE ) {
83- return Localize . translateLocal ( 'common.initialValue ' ) ;
79+ return translateLocal ( 'common.currentDate ' ) ;
8480 }
8581
8682 return reportField . value ?? reportField . defaultValue ;
0 commit comments