Final working solution: shadcn date picker with timezone fix
- Implemented shadcn/ui date picker with Czech localization - Added month/year dropdown navigation for easy date selection - Fixed critical timezone bug causing "No valid days found" error - Changed from toISOString() to local date formatting - Dates now correctly sent as 2025-01-01 instead of 2024-12-31 - Calendar auto-closes after date selection - All features tested and working: - Journey calculation with correct date ranges - "Vyplnit na web" button visible and functional - Excel export working - Backend successfully processes January 2025 data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,14 @@ export default function DataPreview({ data, loading, formData }: DataPreviewProp
|
||||
setFillResult(null)
|
||||
|
||||
try {
|
||||
// Format dates as YYYY-MM-DD in local timezone
|
||||
const formatLocalDate = (date: Date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_URL}/api/fill/journeybook`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -31,8 +39,8 @@ export default function DataPreview({ data, loading, formData }: DataPreviewProp
|
||||
body: JSON.stringify({
|
||||
username: formData.username,
|
||||
password: formData.password,
|
||||
start_date: formData.startDate,
|
||||
end_date: formData.endDate,
|
||||
start_date: formatLocalDate(formData.startDate),
|
||||
end_date: formatLocalDate(formData.endDate),
|
||||
start_km: parseInt(formData.startKm),
|
||||
end_km: parseInt(formData.endKm),
|
||||
vehicle_registration: formData.vehicleRegistration,
|
||||
@@ -142,7 +150,7 @@ export default function DataPreview({ data, loading, formData }: DataPreviewProp
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{formData && formData.startDate === '2025-01-01' && (
|
||||
{formData && (
|
||||
<div className="mt-4">
|
||||
<Button
|
||||
onClick={handleFillToWebsite}
|
||||
|
||||
Reference in New Issue
Block a user