Changeset 4130df3 in rattail


Ignore:
Timestamp:
11/15/2022 05:00:34 PM (3 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
2c0abe9
Parents:
b89af59
Message:

Allow misc. date formats for certain versions of KeHE invoices

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/contrib/vendors/invoices/kehe.py

    rb89af59 r4130df3  
    108108            return datetime.datetime.strptime(data['Invoice Date'], '%Y-%m-%d').date()
    109109        elif version in (2, 3):
    110             return datetime.datetime.strptime(data['InvoiceDate'], '%m/%d/%Y %I:%M:%S %p').date()
     110            try:
     111                return datetime.datetime.strptime(data['InvoiceDate'], '%m/%d/%Y %I:%M:%S %p').date()
     112            except ValueError:
     113                return datetime.datetime.strptime(data['InvoiceDate'], '%m/%d/%Y').date()
    111114        elif version == 4:
    112115            return datetime.datetime.strptime(data['InvoiceDate'], '%m/%d/%Y').date()
Note: See TracChangeset for help on using the changeset viewer.