gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Date parsing in Postgres/GNUmed


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Date parsing in Postgres/GNUmed
Date: Sun, 7 Aug 2011 10:50:42 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Aug 06, 2011 at 02:45:17PM -0700, Jim Busser wrote:

> Shown are what I get, in
>
>       Demographics
> 
> respectively. What I described about rejecting the
> auto-snap was in the Demographics plugin when, not liking
> 1986-11-01, I hit the escape key and clicked the Save button
> and GNUmed accepted
> 
>       11/1/86
> 
> and left it showing that way to the right of "Born" even
> though GNUmed and I had rather different understandings of
> what had been saved.

I understand the split-brain situation that you feel unhappy
about. Let us dissect it:

- you enter 11/1/86
- you dismiss the date suggestions
- no date is attached to "Born"
- you hit save
- GNUmed validates the field
- "Born" does not have a date attached
- GNUmed looks at the string inside "Born"
- GNUmed parses that string
- it finds "1986-11-01" as the only match
- it uses that match
- it saves
- it is done

I see. It would, indeed, not refresh the date field to show
a better (!) representation of what it parsed. Normally,
this would not matter so much, because the edit area would
be dismissed.

Digging deeper into the phrasewheel code shows that there
the reworked code refreshes much better but there's room for
improvement.

I have now inflated the list of explicit, additional
patterns to:

        patterns.append('%Y-%m-%d')
        patterns.append('%y-%m-%d')
        patterns.append('%Y/%m/%d')
        patterns.append('%y/%m/%d')

        patterns.append('%d-%m-%Y')
        patterns.append('%d-%m-%y')
        patterns.append('%d/%m/%Y')
        patterns.append('%d/%m/%y')

        patterns.append('%m-%d-%Y')
        patterns.append('%m-%d-%y')
        patterns.append('%m/%d/%Y')
        patterns.append('%m/%d/%y')

        patterns.append('%Y.%m.%d')
        patterns.append('%y.%m.%d')

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



reply via email to

[Prev in Thread] Current Thread [Next in Thread]