summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 7cd1e36..575e0e1 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -1750,16 +1750,14 @@ sub map_history {
time_zone => 'Europe/Berlin'
);
- if ( $filter_from )
- {
+ if ($filter_from) {
$filter_from = $parser->parse_datetime($filter_from);
}
else {
$filter_from = undef;
}
- if ( $filter_until )
- {
+ if ($filter_until) {
$filter_until = $parser->parse_datetime($filter_until)->set(
hour => 23,
minute => 59,
@@ -2733,30 +2731,34 @@ sub add_intransit_form {
)
{
$station = $+{stop};
+
# attempt to parse "07:08" short timestamp first
$ts = $time_parser->parse_datetime( $+{timestamp} );
- if ( $ts ) {
+ if ($ts) {
+
# fill in last stop's (or at the first stop, our departure's)
# date to complete the datetime
$ts = $ts->set(
- year => $prev_ts->year,
+ year => $prev_ts->year,
month => $prev_ts->month,
- day => $prev_ts->day
+ day => $prev_ts->day
);
+
# if we go back in time with this, assume we went
# over midnight and add a day, e.g. in case of a stop
# at 23:00 followed by one at 01:30
- if ($ts < $prev_ts) {
+ if ( $ts < $prev_ts ) {
$ts = $ts->add( days => 1 );
}
- } else {
+ }
+ else {
# do a full datetime parse
$ts = $parser->parse_datetime( $+{timestamp} );
}
if ( $ts and $ts >= $prev_ts ) {
$station_data{sched_arr} = $ts->epoch;
$station_data{sched_dep} = $ts->epoch;
- $prev_ts = $ts;
+ $prev_ts = $ts;
}
else {
$self->render(