Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handleClick = () => {console.log('click on point')}
const { _lat, _long } = point.point;
return (
);
}
<div>
<label>Current Status: </label>
{process.status}
</div>
<div>
<label>Enable: </label>
</div>
{/* Last update time, tooltip on mouse hover */}
<div title="{process.lastUpdatedAt}">
<label>Last update: </label>
{formatDistanceToNow(parseDate(process.lastUpdatedAt))}
</div>
);
};
parameterizeTask(task) {
const offset = differenceInMilliseconds(new Date(), parseISO(task.created));
// Increment all timestamps in the task by offset
const iter = obj => {
if (!obj) {
return obj;
}
switch (typeof obj) {
case 'object':
return Array.isArray(obj)
? obj.map(iter)
: Object.entries(obj).reduce(
(o, [key, value]) => ({ ...o, [key]: iter(value) }),
{}
);
case 'string':
const processDate = (value: string, useLocalTime?: boolean, showDate?: boolean): string => {
if (!useLocalTime) {
return value;
}
const lines = value.split('\n');
for (let i = 0; i < lines.length; i++) {
const l = lines[i];
const dt = l.substring(0, DATE_LENGTH);
if (DATE_PATTERN.test(dt)) {
const d = parseDate(dt);
const dst = formatDate(d, `${showDate ? 'yyyy-MM-dd ' : ''}HH:mm:ss`);
lines[i] = dst + l.substring(DATE_LENGTH);
}
}
return lines.join('\n');
};
function parseDate(dt) {
return typeof dt === "string" ? parseISO(dt) : dt;
}
function date(dt, ft) {
export function formatRelativeExpirationDate(date: string | number | Date): string {
return `${formatDistanceStrict(typeof date === 'string' ? parseISO(date) : date, Date.now())} ${
isProductLicenseExpired(date) ? 'ago' : 'remaining'
}`
}
const yearClose = format(parseISO(grave.dateClose), 'uuuu');
if (!this.isPast()) {
const date = parseISO(grave.dateClose);
return (
<time datetime="{format(date,">
{monthOpen}
<br>
{format(date, 'uuuu')}
</time>
);
}
return (
<time datetime="{format(parseISO(grave.dateOpen),">
{yearOpen}
</time>
{' - '}
<time datetime="{format(parseISO(grave.dateClose),">
{yearClose}
</time>
);
}
transform(value: any): string {
if (!value) {
return '';
} else if (typeof value === 'string') {
value = parseISO(value);
} else {
value = new Date(value);
}
if (isValid(value)) {
return formatDistance(value, new Date(), { addSuffix: true });
} else {
return '';
}
}
}
function displayDate(date) {
if (isToday(parseISO(date))) {
return "Today";
} else if (isTomorrow(parseISO(date))) {
return "Tomorrow";
} else {
return format(parseISO(date), "iiii d MMMM");
}
}
{props.name}
);
}