[Mayan EDMS: 2144] Date parser confuses my user

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Mayan EDMS: 2144] Date parser confuses my user

I'm wondering if there is an easier way to parse a datetime object according to the local profile a user has.
I have a metadata entity that represents a date , validating and parsing is enabled. Despite what local profile a user is using, the entered data will, if possible always interpreted as mdy:

2/11/2000 > 2000--02-11 but
15/03/2000 > 2000-03-15

Technical I understand of course what happens here.But for a user it's confusing.

I'm working in a multilingual environment, profiles are therefor different. Most of the users have a British background so they prefer ddmmyy and that an input like 2/11/2000 renders to 2nd November 2000.
So I modified metadata/parsers.py to:

class DateParser(MetadataParser):
    def execute(self, input_data):
        return parse(input_data,dayfirst=True).date().isoformat()

But this is now hard coded...

Any ideas to make it more flexible?



You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.