mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 23:16:46 +00:00
fix: clear every open Sonar security issue, and half the reliability ones (#2037)
* fix(security): mint idempotency keys properly, and resolve the extractor by path Three findings out of a sweep of every open Sonar security issue. The other 49 turned out to be false positives and are documented in sonar-project.properties rather than changed — each entry scoped to a file, never a whole rule, so a future Math.random() on an auth path still fails. The idempotency key is the one that can lose data. Both producers fell back to Math.random when crypto.randomUUID was missing, and randomUUID needs a secure context — TREK's own quickstart is http://localhost:3000 and LAN installs run on http://192.168.x.x, so on the deployments the README documents the fallback is what actually runs. The axios one was `Math.random().toString(36).slice(2)`, which is not length-stable: 0.5 yields a single character and 0 yields the empty string, which the interceptor reads as "no key" and skips deduplication for entirely. Two writes sharing a key collapse into one — the second gets the first one's cached response and the edit is gone with no error anywhere. Both now come from utils/randomId, which has the getRandomValues rung that works in insecure contexts too. The extractor probe stored the bare binary name, so every extraction re-resolved it through whatever PATH held at that moment. The official image sets KITINERARY_EXTRACTOR_PATH and never reaches that branch, but a bare-metal install without it ran an unqualified name from a PATH it does not control. It now walks the search path itself and keeps the absolute path of the file it verified; execFileSync also drops the /bin/sh hop the old probe needed. PATH comes through app-config because process.env is walled off in src/. * fix: four tests and sorts that were not doing what they claimed Sonar reported 43 high-impact reliability issues. Reading all of them, four are real; the rest are cosmetic or would be made worse by the suggested change. budget.test.ts hand-built `paid: true`, but both emitters send `paid: body.paid ? 1 : 0` and the handler stores the value verbatim — the test asserted a payload the server never sends. The line below it already used a number. admin.controller.test.ts had a `.resolves` assertion with no await. The promise was dropped, so that line could not fail the test. The two to-do category lists sorted with a bare .sort(), which is byte order: every accented name files behind the whole ASCII range, so in a German trip "Übernachtung" lands after "Zelt". TREK ships 23 locales, so this is real data. One side effect worth knowing: katColor picks a category's dot colour by its index, so re-sorting can move which category shows which colour — it already moves whenever a category is added, and the colour carries no meaning. Deliberately not changed: the two `| 0` truncations (Math.trunc is not equivalent — `| 0` wraps at 32 bits and these carry millisecond timestamps), the two .map() callbacks whose second parameter is declared and used, and the sha1 in thumbnail.service (its own comment says a swap would orphan every existing thumbnail). * refactor: give every button a type, and prefer the Number statics Two mechanical sweeps, no behaviour change intended in either. A <button> with no type attribute is type="submit" per the HTML spec. Outside a form that does nothing today, but it turns into a surprise the moment the markup is wrapped in one, which is what Sonar's S9011 is warning about. 870 buttons get an explicit type="button". Two things were left alone on purpose: buttons that take a {...spread}, because the spread may carry a type and the merge order decides which wins, and anything inside a <form> — there the answer is a judgement call, and checking all eleven form files found every real submit button already carrying type="submit". The Number sweep covers only the three globals that are exactly equivalent to their Number twin: parseInt, parseFloat and NaN. isNaN is NOT in it — the global coerces its argument, so isNaN('abc') is true where Number.isNaN('abc') is false, and renaming it would change what the code does. It reaches server and plugin-sdk as well as the client; both copies of egress-policy.ts got the identical edit, so the mirror the SDK's parity test guards stays intact.
This commit is contained in:
@@ -386,7 +386,7 @@ export default function MAdminBackupPanel() {
|
||||
>
|
||||
<select
|
||||
value={String(autoSettings.hour)}
|
||||
onChange={e => handleAutoSettingsChange('hour', parseInt(e.target.value, 10))}
|
||||
onChange={e => handleAutoSettingsChange('hour', Number.parseInt(e.target.value, 10))}
|
||||
className={SELECT_CLASS}
|
||||
>
|
||||
{HOURS.map(h => {
|
||||
@@ -426,7 +426,7 @@ export default function MAdminBackupPanel() {
|
||||
<MAdminField label={t('backup.auto.dayOfMonth')} hint={t('backup.auto.dayOfMonthHint')}>
|
||||
<select
|
||||
value={String(autoSettings.day_of_month)}
|
||||
onChange={e => handleAutoSettingsChange('day_of_month', parseInt(e.target.value, 10))}
|
||||
onChange={e => handleAutoSettingsChange('day_of_month', Number.parseInt(e.target.value, 10))}
|
||||
className={SELECT_CLASS}
|
||||
>
|
||||
{DAYS_OF_MONTH.map(d => (
|
||||
|
||||
@@ -187,7 +187,7 @@ const PERM_KEYS = PLUGIN_PERMISSIONS
|
||||
const KNOWN_TYPES = ['widget', 'page', 'integration', 'trip-page']
|
||||
|
||||
function isNewer(a: string, b: string): boolean {
|
||||
const nums = (v: string) => v.split('-')[0].split('.').map(n => parseInt(n, 10) || 0)
|
||||
const nums = (v: string) => v.split('-')[0].split('.').map(n => Number.parseInt(n, 10) || 0)
|
||||
const pa = nums(a), pb = nums(b)
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const x = pa[i] || 0, y = pb[i] || 0
|
||||
@@ -850,7 +850,7 @@ export default function MAdminPluginsPanel() {
|
||||
<div className={`flex items-center gap-2.5 rounded-[18px] border px-3.5 py-2.5 ${PENDING_CARD}`}>
|
||||
<ArrowUpCircle size={16} className="shrink-0 text-[color:var(--m-st-pending)]" />
|
||||
<span className="text-[0.6875rem] text-m-muted">{t('admin.plugins.updatesAvailable', { count: updatable.length })}</span>
|
||||
<button onClick={() => updatable.forEach(runUpdate)}
|
||||
<button type="button" onClick={() => updatable.forEach(runUpdate)}
|
||||
className="ml-auto rounded-full bg-[color:var(--m-st-pending)] px-3 py-1.5 text-[0.6875rem] font-bold text-white">
|
||||
{t('admin.plugins.updateAll')}
|
||||
</button>
|
||||
@@ -956,7 +956,7 @@ export default function MAdminPluginsPanel() {
|
||||
{egressFor.hosts.map(h => (
|
||||
<div key={h} className="flex items-center justify-between gap-2 rounded-xl border border-[color:var(--m-rowbr)] px-3 py-2">
|
||||
<span className="break-all font-mono text-sm text-m-ink">{h}</span>
|
||||
<button
|
||||
<button type="button"
|
||||
disabled={egressSaving}
|
||||
onClick={() => saveEgress(egressFor.hosts.filter(x => x !== h))}
|
||||
className="text-m-faint disabled:opacity-50"
|
||||
@@ -1163,7 +1163,7 @@ function InstalledRow({ p, t, busy, hasUpdate, latestVer, blocked, onToggle, onU
|
||||
<div className="mt-2 flex items-center gap-1.5 text-[11.5px] text-[color:var(--m-st-pending)]">
|
||||
<ShieldAlert size={13} className="shrink-0" />
|
||||
<span className="truncate">{t('admin.plugins.updateBlocked', { reason: p.updateBlock.detail ?? p.updateBlock.code })}</span>
|
||||
<button onClick={onReviewBlock}
|
||||
<button type="button" onClick={onReviewBlock}
|
||||
className="shrink-0 font-semibold underline underline-offset-2">
|
||||
{t('admin.plugins.reviewBlock')}
|
||||
</button>
|
||||
@@ -1186,7 +1186,7 @@ function InstalledRow({ p, t, busy, hasUpdate, latestVer, blocked, onToggle, onU
|
||||
Actionable, and warning-toned until at least one host exists, because
|
||||
until then the plugin cannot reach anything and looks silently broken. */}
|
||||
{p.operatorEgress && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={onEgress}
|
||||
title={t('admin.plugins.allowedHosts.hint')}
|
||||
className={`inline-flex items-center gap-1.5 rounded-md border px-2 py-[3px] text-[11px] font-medium ${p.egressHostCount > 0 ? CHIP_INFO : CHIP_PENDING}`}
|
||||
@@ -1212,7 +1212,7 @@ function InstalledRow({ p, t, busy, hasUpdate, latestVer, blocked, onToggle, onU
|
||||
|
||||
{hasUpdate && (
|
||||
<div className="mt-2.5 border-t border-[color:var(--m-rowbr)] pt-2.5">
|
||||
<button onClick={onUpdate} disabled={busy === p.id} title={t('admin.plugins.updateTo', { version: latestVer })}
|
||||
<button type="button" onClick={onUpdate} disabled={busy === p.id} title={t('admin.plugins.updateTo', { version: latestVer })}
|
||||
className={`inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[11.5px] font-bold disabled:opacity-50 ${CHIP_PENDING}`}>
|
||||
<ArrowUpCircle size={13} /> {t('admin.plugins.updateTo', { version: latestVer })}
|
||||
</button>
|
||||
@@ -1267,7 +1267,7 @@ function EmptyState({ t, onDiscover }: { t: T; onDiscover: () => void }) {
|
||||
<PackageOpen size={26} className="text-m-faint" />
|
||||
</div>
|
||||
<p className="text-sm font-medium text-m-muted">{t('admin.plugins.empty')}</p>
|
||||
<button onClick={onDiscover} className={`mt-4 ${ACT_PILL}`}>
|
||||
<button type="button" onClick={onDiscover} className={`mt-4 ${ACT_PILL}`}>
|
||||
<Download size={14} /> {t('admin.plugins.tabDiscover')}
|
||||
</button>
|
||||
</div>
|
||||
@@ -1340,7 +1340,7 @@ function RegistryList({ items, onInstall, onOpenDetail, busy, t, installedIds, f
|
||||
<Download size={11} /> {formatCompactCount(item.downloadCount)}
|
||||
</span>
|
||||
)}
|
||||
<button onClick={e => { e.stopPropagation(); onInstall(item.id, offer.version) }}
|
||||
<button type="button" onClick={e => { e.stopPropagation(); onInstall(item.id, offer.version) }}
|
||||
disabled={busy === item.id || installed || offer.blocked}
|
||||
title={installed ? undefined : offer.title}
|
||||
className={`ml-auto ${ACT_PILL}`}>
|
||||
@@ -1401,7 +1401,7 @@ function PluginDetailSheet({ item, installed, busy, onInstall, onClose, t, local
|
||||
<div className="relative flex-none">
|
||||
<Screenshot url={item.screenshotUrl} className="aspect-[16/9] w-full" iconSize={36} />
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/50 to-transparent" />
|
||||
<button onClick={onClose} aria-label={t('common.close')} className="absolute right-3 top-3 grid h-8 w-8 place-items-center rounded-lg bg-black/40 text-white"><X size={16} /></button>
|
||||
<button type="button" onClick={onClose} aria-label={t('common.close')} className="absolute right-3 top-3 grid h-8 w-8 place-items-center rounded-lg bg-black/40 text-white"><X size={16} /></button>
|
||||
</div>
|
||||
|
||||
<div className="min-h-0 flex-1 overflow-y-auto">
|
||||
@@ -1416,7 +1416,7 @@ function PluginDetailSheet({ item, installed, busy, onInstall, onClose, t, local
|
||||
</div>
|
||||
<p className="mt-0.5 text-[12.5px] text-m-faint">{item.author}{item.latest ? ` · v${item.latest}` : ''}</p>
|
||||
</div>
|
||||
<button onClick={() => onInstall(item.id, offer.version)}
|
||||
<button type="button" onClick={() => onInstall(item.id, offer.version)}
|
||||
disabled={busy === item.id || installed || offer.blocked}
|
||||
title={installed ? undefined : offer.title}
|
||||
className={`${ACT_PILL} self-end`}>
|
||||
@@ -1711,7 +1711,7 @@ function DependencyResolveSheet({ data, t, busy, installedIds, onDownload, onClo
|
||||
: t('admin.plugins.dep.requires', { version: r.constraint })}
|
||||
</div>
|
||||
</div>
|
||||
<button onClick={() => onDownload(r.id, r.constraint)} disabled={busy}
|
||||
<button type="button" onClick={() => onDownload(r.id, r.constraint)} disabled={busy}
|
||||
className={`shrink-0 ${ACT_PILL}`}>
|
||||
<Download size={13} /> {r.installed ? t('admin.plugins.dep.update') : t('admin.plugins.dep.download')}
|
||||
</button>
|
||||
@@ -1748,7 +1748,7 @@ function SecurityInfo({ t }: { t: T }) {
|
||||
<ShieldCheck size={14} className="mt-0.5 shrink-0 text-m-faint" />
|
||||
<p className="text-xs text-m-muted">{t('admin.plugins.reviewedMeaning')}</p>
|
||||
</div>
|
||||
<button onClick={() => setOpen(o => !o)}
|
||||
<button type="button" onClick={() => setOpen(o => !o)}
|
||||
className="flex w-full items-center justify-between gap-2 border-t border-[color:var(--m-rowbr)] px-4 py-3 text-xs font-medium text-m-muted">
|
||||
<span className="flex items-center gap-2"><Lock size={13} className="shrink-0" /> <span className="text-left">{t('admin.plugins.security.title')}</span></span>
|
||||
<ChevronDown size={15} className={`shrink-0 transition-transform ${open ? 'rotate-180' : ''}`} />
|
||||
|
||||
@@ -153,7 +153,7 @@ function MCurrencyWidget(): React.ReactElement {
|
||||
|
||||
const currencies = rates ? Object.keys(rates).sort() : [...CURRENCIES]
|
||||
const rate = rates?.[to] ?? null
|
||||
const converted = rate != null ? (parseFloat(amount.replace(',', '.')) || 0) * rate : null
|
||||
const converted = rate != null ? (Number.parseFloat(amount.replace(',', '.')) || 0) * rate : null
|
||||
const swap = () => { setFrom(to); setTo(from) }
|
||||
|
||||
return (
|
||||
|
||||
@@ -139,7 +139,7 @@ export default function MJourneyEntrySheet({
|
||||
if (group.provider === activeProvider) group.assetIds.forEach(assetId => providerExistingAssetIds.add(assetId))
|
||||
})
|
||||
}
|
||||
const contextLocation = isValidGeoPoint({ lat: locationLat ?? NaN, lng: locationLng ?? NaN })
|
||||
const contextLocation = isValidGeoPoint({ lat: locationLat ?? Number.NaN, lng: locationLng ?? Number.NaN })
|
||||
? { lat: locationLat!, lng: locationLng!, name: locationName || undefined }
|
||||
: null
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ function channelLum(v: number): number {
|
||||
function relLuminance(hex: string): number {
|
||||
const c = hex.replace('#', '')
|
||||
const full = c.length === 3 ? c.split('').map((x) => x + x).join('') : c
|
||||
const r = channelLum(parseInt(full.slice(0, 2), 16) / 255)
|
||||
const g = channelLum(parseInt(full.slice(2, 4), 16) / 255)
|
||||
const b = channelLum(parseInt(full.slice(4, 6), 16) / 255)
|
||||
const r = channelLum(Number.parseInt(full.slice(0, 2), 16) / 255)
|
||||
const g = channelLum(Number.parseInt(full.slice(2, 4), 16) / 255)
|
||||
const b = channelLum(Number.parseInt(full.slice(4, 6), 16) / 255)
|
||||
return 0.2126 * r + 0.7152 * g + 0.0722 * b
|
||||
}
|
||||
function contrastRatio(a: string, b: string): number {
|
||||
|
||||
@@ -125,8 +125,8 @@ export default function MCostSheet({ tripId, base, people, me, editing, prefill,
|
||||
const isTicketMode = splitMode === 'ticket'
|
||||
const ticketInfo = useMemo(() => calculateTicketShares(ticketItems), [ticketItems])
|
||||
|
||||
const totalNum = isTicketMode ? ticketInfo.total : (parseFloat(total) || 0)
|
||||
const splitSum = [...participants].reduce((sum, id) => sum + (parseFloat(customAmounts[id]) || 0), 0)
|
||||
const totalNum = isTicketMode ? ticketInfo.total : (Number.parseFloat(total) || 0)
|
||||
const splitSum = [...participants].reduce((sum, id) => sum + (Number.parseFloat(customAmounts[id]) || 0), 0)
|
||||
const customBalanced = Math.round(splitSum * 100) === Math.round(totalNum * 100)
|
||||
const each = participants.size > 0 ? totalNum / participants.size : 0
|
||||
const equalShares = useMemo(
|
||||
@@ -139,12 +139,12 @@ export default function MCostSheet({ tripId, base, people, me, editing, prefill,
|
||||
if (emptyParts.length === 0) return {}
|
||||
const enteredSum = [...participants]
|
||||
.filter(id => customAmounts[id])
|
||||
.reduce((sum, id) => sum + (parseFloat(customAmounts[id]) || 0), 0)
|
||||
.reduce((sum, id) => sum + (Number.parseFloat(customAmounts[id]) || 0), 0)
|
||||
const remaining = Math.max(0, totalNum - enteredSum)
|
||||
return splitEqualShares(remaining, emptyParts.map(id => ({ user_id: id })), editing?.id || 0)
|
||||
}, [totalNum, participants, customAmounts, editing])
|
||||
|
||||
const ticketValid = ticketItems.length > 0 && ticketItems.every(item => item.name.trim().length > 0 && (parseFloat(item.price) || 0) > 0 && item.participants.size > 0)
|
||||
const ticketValid = ticketItems.length > 0 && ticketItems.every(item => item.name.trim().length > 0 && (Number.parseFloat(item.price) || 0) > 0 && item.participants.size > 0)
|
||||
const payersOk = !multiPayer || (payerIds.size > 0 && payersBalanced(payerAmounts, payerIds, totalNum))
|
||||
const valid = name.trim().length > 0 && payersOk && (
|
||||
isTicketMode
|
||||
@@ -237,12 +237,12 @@ export default function MCostSheet({ tripId, base, people, me, editing, prefill,
|
||||
// server re-derives total_price from the payer sum (CostsPanel.helpers), so
|
||||
// dropping the payer would store the entry with a total of 0.
|
||||
const payerList = multiPayer
|
||||
? [...payerIds].map(id => ({ user_id: id, amount: parseFloat(payerAmounts[id]) || 0 })).filter(p => p.amount > 0)
|
||||
? [...payerIds].map(id => ({ user_id: id, amount: Number.parseFloat(payerAmounts[id]) || 0 })).filter(p => p.amount > 0)
|
||||
: payerId > 0 ? [{ user_id: payerId, amount: totalNum }] : []
|
||||
const memberList = [...participants].map(id => ({
|
||||
user_id: id,
|
||||
amount: splitMode === 'custom'
|
||||
? (parseFloat(customAmounts[id]) || 0)
|
||||
? (Number.parseFloat(customAmounts[id]) || 0)
|
||||
: splitMode === 'ticket'
|
||||
? (ticketInfo.shares[id] || 0)
|
||||
: null,
|
||||
|
||||
@@ -33,8 +33,8 @@ function findDuplicateName(
|
||||
): string | null {
|
||||
const name = form.name.trim().toLowerCase()
|
||||
const gid = (form.google_place_id || '').trim()
|
||||
const lat = form.lat ? parseFloat(form.lat) : null
|
||||
const lng = form.lng ? parseFloat(form.lng) : null
|
||||
const lat = form.lat ? Number.parseFloat(form.lat) : null
|
||||
const lng = form.lng ? Number.parseFloat(form.lng) : null
|
||||
for (const p of places || []) {
|
||||
if (gid && p.google_place_id && p.google_place_id === gid) return p.name || form.name
|
||||
if (name && p.name && p.name.trim().toLowerCase() === name) return p.name
|
||||
@@ -236,8 +236,8 @@ export default function MPlaceEditSheet({ planner, onOpenExpense }: MPlaceEditSh
|
||||
try {
|
||||
const saved = await handleSavePlace({
|
||||
...form,
|
||||
lat: form.lat ? parseFloat(form.lat) : null,
|
||||
lng: form.lng ? parseFloat(form.lng) : null,
|
||||
lat: form.lat ? Number.parseFloat(form.lat) : null,
|
||||
lng: form.lng ? Number.parseFloat(form.lng) : null,
|
||||
category_id: form.category_id || null,
|
||||
_pendingFiles: pendingFiles.length > 0 ? pendingFiles : undefined,
|
||||
})
|
||||
|
||||
@@ -685,7 +685,7 @@ function AddPaymentSheet({ open, onClose, tripId, base, people, me, toast, t, on
|
||||
setSaving(false)
|
||||
}, [open, me, people])
|
||||
|
||||
const amt = parseFloat(amount.replace(',', '.')) || 0
|
||||
const amt = Number.parseFloat(amount.replace(',', '.')) || 0
|
||||
const valid = amt > 0 && fromId !== toId
|
||||
|
||||
const save = async () => {
|
||||
|
||||
@@ -87,8 +87,8 @@ export default function MPackItemSheet({
|
||||
const trimmedName = name.trim()
|
||||
setSaving(true)
|
||||
try {
|
||||
const qty = Math.max(1, Math.min(999, parseInt(quantity, 10) || 1))
|
||||
const weightVal = weight.trim() === '' ? null : Math.max(0, parseInt(weight, 10) || 0)
|
||||
const qty = Math.max(1, Math.min(999, Number.parseInt(quantity, 10) || 1))
|
||||
const weightVal = weight.trim() === '' ? null : Math.max(0, Number.parseInt(weight, 10) || 0)
|
||||
await tripActions.updatePackingItem(tripId, item.id, {
|
||||
name: trimmedName,
|
||||
quantity: qty,
|
||||
|
||||
@@ -598,8 +598,8 @@ function PackingCategoryCard({
|
||||
|
||||
return (
|
||||
<div className="mt-[10px] overflow-hidden rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop">
|
||||
{/* A <div role="button"> rather than a real <button> — the rename input and
|
||||
the assign/menu triggers below are interactive elements a <button> may
|
||||
{/* A <div role="button"> rather than a real <button type="button"> — the rename input and
|
||||
the assign/menu triggers below are interactive elements a <button type="button"> may
|
||||
not contain (invalid HTML); this stays keyboard-operable via onKeyDown. */}
|
||||
<div
|
||||
role="button"
|
||||
|
||||
@@ -196,9 +196,9 @@ export function categoryBreakdown(items: BudgetItem[], ctx: CostsCtx): CostsCate
|
||||
/** Category colour at a fixed alpha — the expense card's border tint (spec §3.10: "brC"). */
|
||||
export function tint(hex: string, alpha: number): string {
|
||||
const clean = hex.replace('#', '')
|
||||
const r = parseInt(clean.slice(0, 2), 16)
|
||||
const g = parseInt(clean.slice(2, 4), 16)
|
||||
const b = parseInt(clean.slice(4, 6), 16)
|
||||
const r = Number.parseInt(clean.slice(0, 2), 16)
|
||||
const g = Number.parseInt(clean.slice(2, 4), 16)
|
||||
const b = Number.parseInt(clean.slice(4, 6), 16)
|
||||
return `rgba(${r}, ${g}, ${b}, ${alpha})`
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,9 @@ export function sortTodoRows(items: TodoItem[], sortByPriority: boolean, today:
|
||||
export function todoCategories(items: TodoItem[]): string[] {
|
||||
const cats = new Set<string>()
|
||||
items.forEach(i => { if (i.category) cats.add(i.category) })
|
||||
return Array.from(cats).sort()
|
||||
// Same locale collation as the desktop hook (useTodoList) — a bare .sort() is
|
||||
// byte order and files every accented name behind the whole ASCII range.
|
||||
return Array.from(cats).sort((a, b) => a.localeCompare(b))
|
||||
}
|
||||
|
||||
/** Open (non-done) item count for a given category — matches the desktop sidebar badge. */
|
||||
|
||||
@@ -348,7 +348,7 @@ function YearTypeRows() {
|
||||
value={String(yearSettings.year_start_month)}
|
||||
placeholder={t('vacay.yearStartMonth')}
|
||||
options={monthOptions}
|
||||
onChange={v => save({ year_start_month: parseInt(v, 10) })}
|
||||
onChange={v => save({ year_start_month: Number.parseInt(v, 10) })}
|
||||
/>
|
||||
</span>
|
||||
<span className="w-[86px] flex-none">
|
||||
@@ -356,7 +356,7 @@ function YearTypeRows() {
|
||||
value={String(yearSettings.year_start_day)}
|
||||
placeholder={t('vacay.yearStartDay')}
|
||||
options={Array.from({ length: monthDayCap(yearSettings.year_start_month) }, (_, i) => ({ value: String(i + 1), label: String(i + 1) }))}
|
||||
onChange={v => save({ year_start_day: parseInt(v, 10) })}
|
||||
onChange={v => save({ year_start_day: Number.parseInt(v, 10) })}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@ export interface DayVisualContext {
|
||||
function hexToHsl(hex: string): { h: number; s: number; l: number } | null {
|
||||
const m = /^#([0-9a-f]{6})$/i.exec(hex.trim())
|
||||
if (!m) return null
|
||||
const n = parseInt(m[1], 16)
|
||||
const n = Number.parseInt(m[1], 16)
|
||||
const r = ((n >> 16) & 255) / 255
|
||||
const g = ((n >> 8) & 255) / 255
|
||||
const b = (n & 255) / 255
|
||||
|
||||
Reference in New Issue
Block a user