dbrgn / flugbuech

Web based flight log for paragliding pilots.
https://flugbuech.bargen.dev/
GNU Affero General Public License v3.0
28 stars 1 forks source link

Allow entering dates without times #74

Open dbrgn opened 4 years ago

dbrgn commented 4 years ago

Follow-up of #73.

If you still know the day but not the launch or landing time, it should be possible to enter only the day.

dbrgn commented 3 years ago

I'm not yet sure what the ideal solution would be.

We should probably store date and time separately, with the time being optional. However, time zone handling is a bit tricky.

Schema

Change from

launch_time TIMESTAMP WITH TIME ZONE NULL
landing_time TIMESTAMP WITH TIME ZONE NULL

to

launch_day DATE NULL
launch_time TIME WITH TIME ZONE NULL
landing_day DATE NULL
landing_time TIME WITH TIME ZONE NULL

The time zone moves from the timestamp field to the time field. The application needs to ensure that the proper UTC date is picked for a timestamp, so that when date and time are combined, the same timestamp results.

UI

Right now only a single date can be entered. However, since the times are UTC, when flying in time zones far away from UTC, a flight might cross the UTC date boundary. Therefore we'd need to split up launch and landing date into separate fields.

Right now time should always be entered for UTC. Time zone could be explicitly entered, or it could be derived from the IGC file or the location. In the future, the user could choose whether to show local time, launch time or UTC time.

(What if the user flies across a DST change? I don't want to go down that rabbit hole... Maybe we should completely eliminate time zones from the data and always assume local time?)