I have a calendar view that shows events entered into a database. There is a button on the view that shows two days -- using code @Command([CalendarFormat]; "2"). When the above button is clicked, the calendar view shows tomorrow's events on today's day and moves everything back one day. Any ideas?
I believe this problem is caused by a LotusScript programming error in the code that assigns the date fields in the documents.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
The problem occurs when you assign a date field from a LotusScript date/time variant, using a statement such as:
apptDate = Datenumber(2002, 12, 13)or even
doc.CalDate = apptDate
doc.CalDate = otherDoc.CalDateThe LotusScript date/time variant doesn't have a distinct representation for a date with no time -- it considers that the same as midnight on the given date, in the time zone of the computer running the script. As a result, if the user's workstation is in an earlier time zone than that computer, the entry would appear on the previous day's calendar page, because 12:00 a.m. in Boston, for example, is 11:00 p.m. on the previous day in Minneapolis.
To prevent this problem, always use the NotesDateTime class when working with date fields. In the above example:
Dim fldCalDate As NotesItem
Dim datCalDate As NotesDateTime
Set fldCalDate = otherDoc.GetFirstItem("CalDate")
Set datCalDate = fldCalDate.DateTimeValue
datCalDate.SetAnyTime ' in case there's a time value in the field we're copying, remove it.
Set doc.CalDate = datCalDate
Dig Deeper on Domino Resources - Part 5
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.