Changeset 806:e456d06f32d6 for src


Ignore:
Timestamp:
08/06/16 08:16:48 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Tags:
version_0.38.3
Message:

Fixed the parsing of the beginning and ending times of NOTAMs to handle both 2- and 4-digit years

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/web.py

    r790 r806  
    568568            return None
    569569
     570        def parseTime(item):
     571            try:
     572                return datetime.datetime.strptime(item, "%y%m%d%H%M")
     573            except ValueError:
     574                return datetime.datetime.strptime(item, "%Y%m%d%H%M")
     575
    570576        basic = items["Q)"]
    571         begin = datetime.datetime.strptime(items["B)"], "%y%m%d%H%M")
     577        begin = parseTime(items["B)"])
    572578
    573579        end = None
     
    578584                permanent = True
    579585            else:
    580                 end = datetime.datetime.strptime(items["C)"], "%y%m%d%H%M")
     586                end = parseTime(items["C)"])
    581587        else:
    582588            permanent = True
Note: See TracChangeset for help on using the changeset viewer.