Skip to content

Commit

Permalink
fix: flow errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-yahia committed Jan 6, 2025
1 parent 2cc70be commit 383c66f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import { systemSettingsStore } from '../../../metaDataMemoryStores';
* @returns {(Temporal.PlainDate | null)}
*/

export function convertStringToTemporal(dateString: string): Temporal.PlainDate | null {
type PlainDate = {
year: number,
month: number,
day: number
};

export function convertStringToTemporal(dateString: ?string): PlainDate | null {
if (!dateString) {
return null;
}
Expand All @@ -34,6 +40,6 @@ export function convertStringToTemporal(dateString: string): Temporal.PlainDate
calendar,
});
} catch (error) {
return '';
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @flow
import { Temporal } from '@js-temporal/polyfill';
import { padWithZeros } from './padWithZeros';
import { systemSettingsStore } from '../../../../capture-core/metaDataMemoryStores';

Expand All @@ -9,7 +8,13 @@ import { systemSettingsStore } from '../../../../capture-core/metaDataMemoryStor
* @returns {string} Formatted date string, or empty string if invalid
*/

export function convertTemporalToString(temporalDate: Temporal.PlainDate | null): string {
type PlainDate = {
year: number,
month: number,
day: number
};

export function convertTemporalToString(temporalDate: PlainDate | null): string {
if (!temporalDate) {
return '';
}
Expand Down
4 changes: 0 additions & 4 deletions src/core_modules/capture-ui/AgeField/AgeField.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ type InputMessageClasses = {
validating?: ?string,
}

type DateParser = (value: string) => { isValid: boolean, momentDate: any };

type DateStringFromMomentFormatter = (momentValue: Object) => string;

type ValidationOptions = {
error?: ?string,
errorCode?: ?string,
Expand Down

0 comments on commit 383c66f

Please sign in to comment.