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>
19 lines
1.1 KiB
JavaScript
19 lines
1.1 KiB
JavaScript
/**
|
||
* @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>;
|
||
}
|