1. Matthew Schinckel
  2. django-timedelta-field

Pull requests

#5 Declined
Repository
tim_heap
Branch
default
Repository
schinckel
Branch
default

Make `parse` more robust, support additional languages

Author
  1. Tim Heap
Reviewers
Description

I rewrote the helpers.parse function to achieve a few things:

  • Allow easier definition and modification of time keywords
  • Support multiple languages
  • Support time strings without a leading digit (eg 'day' is the same as '1 day')

The framework for defining extra languages is a dict of regexes for matching the various week, day, hour, minute, and second bits. I have made definitions for English, and a hacked together (very likely incorrect) definition for German for testing. The definitions should probably be moved to a separate file, but I was unsure of your preferences here.

  • Learn about pull requests

Comments (3)