MED-137: add doctor other jobs view (#55)
* add doctor jobs view * change translation * another translation change * clean up * add analaysis detail view to paths config * translation * merge fix * fix path * move components to shared * refactor * imports * clean up
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { format } from 'date-fns';
|
||||
import Isikukood, { Gender } from 'isikukood';
|
||||
|
||||
/**
|
||||
* Check if the code is running in a browser environment.
|
||||
*/
|
||||
@@ -21,3 +24,36 @@ export function formatCurrency(params: {
|
||||
currency: params.currencyCode,
|
||||
}).format(Number(params.value));
|
||||
}
|
||||
|
||||
export function formatDateAndTime(date?: string) {
|
||||
if (!date) return '-';
|
||||
|
||||
return format(date, 'dd.MM.yyyy HH:mm');
|
||||
}
|
||||
|
||||
export function formatDate(date?: string) {
|
||||
if (!date) return '-';
|
||||
|
||||
return format(date, 'dd.MM.yyyy');
|
||||
}
|
||||
|
||||
export function getFullName(
|
||||
firstName?: string | null,
|
||||
lastName?: string | null,
|
||||
) {
|
||||
return [firstName ?? '', lastName ?? ''].join(' ');
|
||||
}
|
||||
|
||||
export const getPersonParameters = (personalCode: string) => {
|
||||
try {
|
||||
const person = new Isikukood(personalCode);
|
||||
return {
|
||||
gender: person.getGender(),
|
||||
dob: person.getBirthday(),
|
||||
age: person.getAge(),
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user