sokko-g/website/src/features/cards/admin/ExpiryField.jsx
Shinuwa 166790245f Turn the comments that describe functions into JSDoc so the editor shows them on hover
The 669 // comments sitting right above a function, method or hook become
/** */ blocks, unchanged in wording; eslint directives stay right above the
line they target. website/AGENTS.md now asks for JSDoc on function comments
and // inside function bodies. ExpeditionPlanner.jsx grew past 300 lines and
gets its full header, as the header test requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:51:47 +01:00

19 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file Saisit une date et une heure d'expiration avec le calendrier et le champ d'heure du design system.
*/
import { useState } from "react";
import { MonthDateDropdown } from "../../toolboxes/modules/CalendarMonthDatePicker.jsx";
import { toDateTimeLocal } from "./adminFormat.js";
const monthStartOf = (dateKey) => new Date(`${dateKey.slice(0, 7)}-01T00:00`);
/** `value` et `onChange` utilisent le format local « AAAA-MM-JJTHH:mm ». */
export function ExpiryField({ label, value, now, onChange }) {
const [date, time] = value.split("T");
const [displayedMonth, setDisplayedMonth] = useState(() => monthStartOf(date));
return <div className="nebula-admin-expiry-field">
<MonthDateDropdown value={date} displayedMonth={displayedMonth} minDate={toDateTimeLocal(now).slice(0, 10)} mode="date" textContent={{}} label={label} onMonthChange={setDisplayedMonth} onChange={(nextDate) => onChange(`${nextDate}T${time}`)} />
<input className="nds-time" data-size="sm" type="time" aria-label="Heure d’expiration" value={time} onChange={(event) => onChange(`${date}T${event.target.value || time}`)} />
</div>;
}