Skip to content

two digit years #10

@Anniepoo

Description

@Anniepoo

Years like '79', to be interpreted as 1979, are not handled correctly.

?- form_time(79-03-15,D).
D = datetime(-650014, _2817026),
_2817026 in 0..86399999999999.

I'm not sure what the fix is.

In some theoretical sense, we could have y2k(40) that would constrain us to interpret years between 40 and 99 as 1940..1999 and years 0..39 as 2000..2039

But obviously I'm here because I naively passed a year in. It'd be nice behavior if form_time just 'did the right thing' - if some y2k constraint was a default. And then we have to have some explicit dont_fix_y2k so the poor soul recording Roman history has a workaround.

But then we have a set of soft constraints

  1. If the year is outside the y2k range, take it as is
  2. If the user supplied a y2k range, use that
  3. otherwise, if the user said dont_fix_y2k, treat as is
  4. otherwise, use the default y2k range

And then there's the mess of asking what it means to have dates before the Gregorian epoch.

As far as implementation, that's also ugly, as everything's a constraint, not a production. Maybe the form Y-M-D could accept Y as yr(79) and do some mapping? or instead of my y2k constraint, have y2k(79,40)-M-D ?

That's ugly but works. No real elegant solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions