mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 09:54:14 +00:00
@
fix(export): print the reader clock format, and split window bookings in the feed Three v4.0.0 reports that all come down to a surface printing what is stored instead of what the reader asked for. The PDF (#2066) is assembled as an HTML string outside React, so no hook could reach it and no time format was ever passed in. It printed the column: four clock sites, all 24h whatever the personal setting or the admin default said, and a place time typed by a 12h user came out as "3:00 PM" for a 24h reader. Both export entry points now hand the format over the way they already hand over the locale, and the four sites go through formatClockTime. The journey editors (#2067) used a native <input type="time">, which paints 12h or 24h from the browser locale and cannot be told otherwise by any attribute. Every other time field in TREK has used CustomTimePicker for exactly that reason; the journey editor, its phone sheet and the phone place sheet were never migrated, so the same place form obeyed the setting on desktop and ignored it on a phone. The picker gained a disabled prop so the read-only journey sheet keeps the affordance the native input gave it. In the subscribed calendar (#2068), a booking that is a window rather than an activity read as one block across its whole range: a week of airport parking sat on all seven days. Both hand-overs now stand on their own — an hour each, carrying what the block used to say — and the block goes. Only when the two ends fall on different days: a same-day booking is one sitting, and a rental with only its pickup geocoded keeps the block, which is the only thing holding the return time and its zone at all. Rental cars were missing outright, because the planner writes reservation_time = NULL when its optional time pickers are left blank while still setting day_id, and nothing in the exporter ever read the linked days. It reads them now, as the last resort, for every type — so a hand-typed bus or train shows up as well. @
This commit is contained in:
@@ -5,6 +5,7 @@ import MSheet from '../../components/MSheet'
|
||||
import MIconBtn from '../../components/MIconBtn'
|
||||
import { useTranslation } from '../../../i18n'
|
||||
import { useToast } from '../../../components/shared/Toast'
|
||||
import CustomTimePicker from '../../../components/shared/CustomTimePicker'
|
||||
import { journeyApi, mapsApi, weatherApi } from '../../../api/client'
|
||||
import { getApiErrorMessage } from '../../../types'
|
||||
import { normalizeImageFiles } from '../../../utils/convertHeic'
|
||||
@@ -728,15 +729,10 @@ export default function MJourneyEntrySheet({
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className={`${eyebrow} mb-[5px]`}>{t('mobileJourney.time')}</div>
|
||||
<div className={`${fieldShell} overflow-hidden`}>
|
||||
<input
|
||||
type="time"
|
||||
value={entryTime}
|
||||
disabled={readOnly}
|
||||
onChange={e => setEntryTime(e.target.value)}
|
||||
className="block min-w-0 w-full box-border border-0 bg-transparent px-3 py-[10px] text-center text-[0.78125rem] font-semibold text-m-ink outline-none [font-variant-numeric:tabular-nums]"
|
||||
/>
|
||||
</div>
|
||||
{/* A native <input type="time"> paints 12h or 24h from the browser
|
||||
locale, whatever the user picked in settings (#2067). The picker
|
||||
brings its own shell, so fieldShell goes with the input. */}
|
||||
<CustomTimePicker value={entryTime} onChange={setEntryTime} disabled={readOnly} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { CalendarPlus, ChevronRight, FileDown, Share2 } from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
import { IcsSubscribeModal } from '../../../../components/Planner/IcsSubscribeModal'
|
||||
import { useTripStore } from '../../../../store/tripStore'
|
||||
import { useSettingsStore } from '../../../../store/settingsStore'
|
||||
import { useTranslation } from '../../../../i18n'
|
||||
import { INNER_CLS, TileHeader } from './MTripSheetUi'
|
||||
import type { MTripSheetsProps } from '../MTripShell'
|
||||
@@ -16,6 +17,8 @@ import type { LucideIcon } from 'lucide-react'
|
||||
*/
|
||||
export default function MExportSheet({ planner, shell }: MTripSheetsProps) {
|
||||
const { t, locale } = useTranslation()
|
||||
// The PDF is built outside React, so it cannot read this itself (#2066).
|
||||
const timeFormat = useSettingsStore(s => s.settings.time_format) || '24h'
|
||||
const open = shell.sheet?.id === 'export'
|
||||
const dayNotes = useTripStore(s => s.dayNotes)
|
||||
const [subscribeOpen, setSubscribeOpen] = useState(false)
|
||||
@@ -46,6 +49,7 @@ export default function MExportSheet({ planner, shell }: MTripSheetsProps) {
|
||||
reservations: planner.reservations,
|
||||
t,
|
||||
locale,
|
||||
timeFormat,
|
||||
})
|
||||
} catch (e) {
|
||||
planner.toast.error(`${t('dayplan.pdfError')}: ${e instanceof Error ? e.message : String(e)}`)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useMemo } from 'react'
|
||||
import { AlertTriangle } from 'lucide-react'
|
||||
import { Eyebrow, FIELD_CLS } from './PlSheetChrome'
|
||||
import { Eyebrow } from './PlSheetChrome'
|
||||
import CustomTimePicker from '../../../../components/shared/CustomTimePicker'
|
||||
import type { Assignment } from '../../../../types'
|
||||
import type { TripPlanner } from '../MTripShell'
|
||||
|
||||
@@ -16,8 +17,6 @@ interface PlTimeFieldsProps {
|
||||
hasTimeError: boolean
|
||||
}
|
||||
|
||||
const TIME_CLS = `${FIELD_CLS} font-semibold [font-variant-numeric:tabular-nums]`
|
||||
|
||||
const WARNING_CLS =
|
||||
'mt-2 flex items-start gap-[6px] rounded-[10px] bg-[rgba(232,161,58,.14)] px-[10px] py-[7px] font-geist text-[0.6875rem] leading-[1.4] text-[color:var(--m-st-pending)]'
|
||||
|
||||
@@ -54,21 +53,11 @@ export default function PlTimeFields({
|
||||
<div className="flex gap-2">
|
||||
<div className="min-w-0 flex-1">
|
||||
<Eyebrow className="mb-[5px] uppercase">{t('places.startTime')}</Eyebrow>
|
||||
<input
|
||||
type="time"
|
||||
value={startTime}
|
||||
onChange={e => onChange('place_time', e.target.value)}
|
||||
className={TIME_CLS}
|
||||
/>
|
||||
<CustomTimePicker value={startTime} onChange={v => onChange('place_time', v)} />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<Eyebrow className="mb-[5px] uppercase">{t('places.endTime')}</Eyebrow>
|
||||
<input
|
||||
type="time"
|
||||
value={endTime}
|
||||
onChange={e => onChange('end_time', e.target.value)}
|
||||
className={TIME_CLS}
|
||||
/>
|
||||
<CustomTimePicker value={endTime} onChange={v => onChange('end_time', v)} />
|
||||
</div>
|
||||
</div>
|
||||
{hasTimeError && (
|
||||
|
||||
Reference in New Issue
Block a user