Tinderbox Forum

Dates & “Getting Started with Tinderbox" Tutorial

Hi,

I’m working through the tutorial, “10. Agents” using Tinderbox 8.2.2. When I set up the agent to populate $StartDate from $PublicationYear, if the year is 1948, for example, the start date is 1/1/2048. It’s like it only has 2 characters for the year, leading to a sort of Y2K problem.

Any way to fix this?

Thanks!

Of course!

First, if you use historic dates, choose 4-digit dates in System Preferences: Language and Region : Advanced. Tinderbox is following your preference for 2-digit dates, and 2048 (astonishingly) is closer to us than 1948.

If you cannot use 4-digit dates in System Preferences, you can also specify an alternative date format in $KeyAttributeDateFormat. But that’s a last resort.

Thanks, that did work around the issue.

I would tend to see this as a bug. Date parsing is extraordinarily hard, but, would anyone ever really want this behavior? Is this due to code in Tinderbox or MacOS?

Thank you for the quick reply, Mark.

  • Eric

This doesn’t affect me one way or another, but out of curiosity I tried entering " 1 / 1 / 48 " in both Google Sheets and Microsoft Excel.

In each case it rendered as “Jan 1, 1948,” FWIW. Maybe the default in those programs is to look for the previous (as opposed to nearest) occurrence of the two-digit year?

Note that I’m passing in the string “1948” to the date function. There is no ambiguity in the input; it seems quite strange (and incorrect) to not parse the full data passed in. This behavior violates some “principle of minimized surprise” for me.

If I were passing in “48” I would be comfortable with whatever convention the software applied (which I would also hope would be documented somewhere…)

FWIW, I don’t have any trouble getting my system to accept 1948 (rather than 2048) as the date, if I enter that four-digit year.

This quick video shows my entering " 1 / 1 / 1948" into a date field. All that I did before this was (a) define a new Date-type attribute, and (b) set the Date format for this file to give the four-digit year reading. FWIW. This is a Dropbox video.

(If the embedded video below doesn’t work, here is the Dropbox link.)

If you enter

 1/13/48

in Numbers, using the default US settings, you get January 13, 2048.

Surely if I enter 1/13/1948 I don’t get 1/13/2048 if I had the short date format set to use 2 digits for the year?

Understood. Numbers (bizarrely) defaults to avoid short date format, and (notably) if you do use short date format, when editing dates Numbers ignores your preference and uses medium date format.

None of this is documented. (Also in today’s mail, I find a registration issue involving the length of the year as measured in non-Gregorian calendars when changing from one calendrical system to another. I fully expect my late-Sunday support queue to include a show-stopper involving time travel.)

Cool, thanks. Have fun! :smiley: