Default century when entering dates

If I enter “4/4/22” in a date field whose output pattern includes “yyyy”, it displays as 4 April 2022 but “4/4/23” displays as 4 April 1923. Any higher year value also displays as 19**.

This happens in both v10.0.0 and v10.0.1.

The oldest version I have is version 0.1.021 (1882), and it happens there as well.

This is intentional. If the century is missing, Panorama X fills it in automatically. Panorama 6 did so also, but a bit differently. Panorama 6 would assume that the year was within 50 years of the current date, plus or minus. Panorama X, however, will assume the date in the past unless it would be within the next five years. I believe that specific dates in the past, like birth dates, are much more common than specific dates in the future. I think it would be very, very unusual to specify a date more than 18 months into the future, but dates from 60, 70 or 80 years ago are much more common (especially birth dates). Of course if you want to specify a date more than five years in the future, simply be sure to fill in the entire century rather than just the last two digits of the year.

Well, that’s not what the Help wizard says:
“Panorama also rounds dates to the current century. If the current year is 2002 (or even 1992) and you enter the date 7/2/23 Panorama will assume you mean 7/2/2023. If you want to enter a date more than 50 years from the current date you must enter the full date, for example 7/2/1923.”

I’ve posted a correction.

Thanks. As I mentioned, this was a change from Panorama 6 to X, and I’m not surprised I missed a spot in the documentation. Fortunately there are a handful of you that keep me honest on the thousands of pages of docs!

I have a date field in which I want to put in a date that is more than 5 years in the future. I read the section in the Help on Dates - Default Year and Century and understand what is going on. If I type in the full year (7/2/2034) like the help suggests, it works.

But I want to use a variable to input a future date into the field. If the future date is within 5 years it works. But if it is further out I can’t get it to work. The result I get in my date field is 100 years earlier than what I want. For example, using a date field called, “Due Date”, a variable named myFutureDate contains a date that is 10 years in the future. (A message statement confirms the variable contains the date May 23, 2029). But when I try something like,

«Due Date» = myFutureDate 

Instead of coming out as May 23, 2029, the result is May 23, 1929.

Is there a way to input a future date further out than five years via a variable in a procedure?

Inside a field or variable, a date is simply an integer number. No months or years, just days. So your assignment is simply assigning an integer value.

So the real question is, how did you get that integer value into the myFutureDate? You assert that this variable contains a date that is 10 years in the future, but based on your description that variable clearly contains a date that is 90 years in the past. Most likely, when the date was ingested into the variable (probably using the date( function), only two digits of the year were provided, so it defaulted to 90 years ago.

Bottom line, when you put a date into your variable, you need to make sure that all four digits of the year are supplied, not just two. For example:

let myFutureDate = date("5/23/2029")

If you only use two digits, like this:

let myFutureDate = date("5/23/29")

you’ll get 1929.

Another possibility would be to check the date and make adjustments, like this code that adds a hundred years to any date before 1950.

let myFutureDate = date("5/23/29")
if myFutureDate < date("1/1/1950")
    myFutureDate = monthmath(myFutureDate,1200)
endif

This will allow dates up to 2050 to be entered as two digit years. Adjust the threshold as needed for your application.

Thank you for your response. It has been a strange journey trying to find out where the problem is. I tried so many things like not using a variable, and even adding 100 years to the result, but nothing worked. The date I was trying to calculate came out 100 years early.

My database is a simple one, with 4 fields. It keeps track of when items are due to be repeated. The relevant fields are three:

TimeInterval, an integer field; LastCompleted and DueDate, both Date fields.

For example, if a belt was due to be replaced every 9 years, I’d put the date when it was last installed, in the “LastCompleted” field and then code in that the “LastCompleted” Field Properties Code section would automatically call a procedure to put the date in, it would be placed in the “DueDate” field, based on the date in the LastCompleted, using the TimeInterval to figure that out. The dates entered in the “LastCompleted” field have been entered with the year using 4 digits. From everything I could see and test (via the message command) the date in the LastCompleted was in the proper format “8/7/2019”.

But my code would never give me the correct results if the time interval was over 5 years.

Finally I discovered that if I removed the code from the Code section of the Field Properties box and instead called the procedure from the Action menu, it gave me the correct results. I’ve attached a gif of this happening. Note that the procedure that is called, “InputDueDate” is the only procedure in this database.

«DueDate» = monthmath(«LastCompleted»,(TimeInterval * 12))

You can see the error in the attached Gif. The gif shows that procedure code that is called and the Field Properties info, with the call procedure.

I actually made 3 movies of the error happening, but then tried a fourth time in order try to get movie shorter. And when I was recording the fourth movie—I noticed it was giving me correct results every time even with the Call Procedure in the Code box of the Field Properties. I did not change anything in the database except to cut the code out of the Field Properties box, and then paste it back in, for the next movie.

I don’t know how to explain how it mysteriously started working correctly. Corrupt file? Computer glitch caused by user error? My trial and error did crash Panorama X many, many times.

The problem is gone, hopefully for good. Thanks for your help!

Veinott

I’m not sure why it’s working for you now, or exactly what you are doing to get the focus to jump from one field to the next. In my own test, opening the the cell for editing causes the edit box to display the date in MM/DD/YY format. Pressing enter or tab causes the number to be reentered without the century, causing it to lose 100 years if the date was originally more than 5 years in the future. Then it runs the code, based on the new date.

This is clearly a bug. When a cell is opened, it should always use the full 4 digit year for display, so that simply tabbing through doesn’t cause a 100 year change in the date.

Thank you, Dave. I was using the “Tab” key to get the focus to jump from one field to the other.

I’m baffled as to why it’s working now. It clearly wasn’t before.

I appreciate your explanation.

I’ve written this up on Bitbucket. I think earlier versions of Panorama would have had a similar bug.