43 lines
961 B
JavaScript
43 lines
961 B
JavaScript
export function formatText(text) {
|
|
if (text == null) return "—";
|
|
|
|
if (typeof(text) === "string") {
|
|
return text;
|
|
}
|
|
else {
|
|
return "Unknown format";
|
|
}
|
|
}
|
|
export function formatSalary(text) {
|
|
if (text == null) return "—";
|
|
|
|
try {
|
|
//vah=r millions = (parseInt(text, 10) / 1000000).toFixed(2);
|
|
let millions = Math.round(parseInt(text, 10) / 1000000);
|
|
return `$${millions} million`;
|
|
} catch (e) {
|
|
return "Unknown format"
|
|
}
|
|
|
|
}
|
|
export function formatDate(date) {
|
|
if (date == null) return "—";
|
|
|
|
if (typeof(date) === "string") {
|
|
return date.split("T")[0];
|
|
}
|
|
else {
|
|
return "Unknown format";
|
|
}
|
|
}
|
|
export function formatDateTime(date) {
|
|
if (date == null) return "—";
|
|
|
|
if (typeof(date) === "string") {
|
|
return date.split("T")[0] + " at " + date.split("T")[1].split(".")[0];
|
|
}
|
|
else {
|
|
return "Unknown format";
|
|
}
|
|
}
|