Hi,
Good day!
I am an application support in one leave system Lotus Notes application. One of our user uses Macbook to approve leaves. When he approves his subordinates’ leaves, the start and end date of the leave application becomes 12/30/1899. It doesn’t get the correct date during the “DateValue” method. Please advise what can we do to fix this. We have already tried to change the settings in both Lotus Notes and his local time’s settings but we encountered the same error.
I have provided a button to him to pop up a messagebox of the datevalue of the start date of the leave form. However, regardless of the date/time settings, the prompted value is “00:00:00”.
Here are the versions of this softwares:
Notes Release 9.0
Revision 20130309.0942 (Release 9.0)
Mac Version 10.9.2
Build 13C1021
Thank you in advance!
Subject: Start and End date are both Notes Date/Time type
Yes, the source are notes date/time type.
Subject: So when you step through the codeq
at which line do the values no longer represent what they should?
post the values as they appear for each line in your code.
Subject: Code Snippet
It happened on both our application and in Calendar wherein the HR team send a button to create a meeting in the calendar and has the same result.
Here is the code that is being called on Post Recalc in our application:
Sub LeaveCalc ( execpoint As String )
’ ** Error Routine ** On Error Goto ErrorHandler ’ ** Create Object ** Set ws = New NotesUIWorkspace Set uidoc = ws.Currentdocument Set doc = uidoc.Document ’ ** Set UI interface to passive mode ** uidoc.AutoReload = False ’ ** Retrieve data from the form object ** startdate = Datevalue( doc.A_StartDate1 ( 0 ) ) enddate = Datevalue ( doc.A_EndDate1 ( 0 ) ) leavetype$ = doc.A_LeaveType1 ( 0 ) halfday$ = doc.A_Halfday1 ( 0 ) holidaydates = doc.A_Holiday max_list = doc.A_LeaveEntitlementLimit Set item = doc.GetFirstItem ( “A_LeaveEntitlementLimitSynonym” ) ’ ** Retrieve maximum leave entitlement for the various leave type ** Call RetrieveMax ( max_list ) ’ ** Validate before process the dates value ** If ( startdate = “” ) Then ’ Messagebox “Required field: ““Start date””” Exit Sub Elseif ( enddate = “” ) Then ’ Messagebox “Required field: ““End date””” Exit Sub Elseif startdate > enddate Then ’ Messagebox “Start date must be before or equal to end date!” Exit Sub End If ’ ** retrieve the cap days for the leave type selected ** Forall max_item In max_list fullstrg$ = Cstr ( max_item ) nlength% = Len ( fullstrg$ ) strg$ = Left ( fullstrg$, nlength% - 10 ) nlength% = Len ( strg$ ) nchar% = Instr ( 1, strg$, “#” ) leftstrg$ = Left$ ( strg$, nchar% - 1 ) rightstrg$ = Right$ ( strg$, nlength% - nchar% ) If leftstrg$ = leavetype$ Then ’ *** Automatic end date calculation for particular sets of leave type *** calctype$ = Left ( Right ( fullstrg$, 9 ), 4 ) disptype$ = Left ( Right ( fullstrg$, 4 ), 1 ) entype$ = Right ( fullstrg$, 2 ) Exit Forall End If End Forall ’ ** if selected leave type, then automatically calculate the end date using the max. day ** ’ ** this shall happen only on exit from the start date field ** If ( item.Contains ( leavetype$ ) ) And ( execpoint$ = “leavetext” Or execpoint$ = “startdate” )Then array = FirstTimeCalc ( leavetype$, startdate, enddate, holidaydates, calctype$, disptype$ ) sum! = array ( 0 ) enddate = array ( 1 ) remainder! = Fraction ( sum! ) If remainder! = 0.5 Then halfday$ = “HAM” End If Else ’ *** Total days between 2 date *** sum! = SubsequentCalc ( leavetype$, startdate, enddate, holidaydates, calctype$ ) ’ *** Half day calculation *** Select Case halfday$ Case “AM” sum! = sum! / 2 Case “PM” sum! = sum! / 2 Case “HAM” sum! = sum! - 0.5 Case “HPM” sum! = sum! - 0.5 Case Else sum! = sum! End Select End If ’ *** Return Value to field *** doc.A_Days1 = sum! doc.A_Halfday1 = halfday$ doc.A_StartDate1 = startdate doc.A_EndDate1 = enddate ’ ** Set UI interface to active mode ** uidoc.AutoReload = True Call uidoc.Reload Exit Sub ErrorHandler: ’ Msg$ = “Date enter is not a valid date ! Please try again !” ’ DialogBoxType& = MB_OK + MB_ICONSTOP ’ DialogTitle$ = “Error Message” ’ Messagebox Msg$, DialogBoxType&, DialogTitle$ Exit Sub End Sub
Subject: Are the source fields text or notesdatetime fields?
Are these fields notes date time fields or strings?
doc.A_StartDate1 ( 0 )
doc.A_EndDate1 ( 0 )
You might be hitting an issue with the conversion from string to date/time (never store datetimes as strings)
Subject: Different button provided
Hi,
I have tried to debug his Mac Computer but I can’t debug it. So what I did is to get the snipped of the code and put it in the button. The expected result should be 10/22/2013. Here is the code for this:
Dim s As New notesSession Dim db As NotesDatabase Dim dateString As String Dim doc As NotesDocument Dim w As Variant server$ = “D23DBL96/23/A/IBM” path$ = “l_dir/leave/thleave.nsf” Set db = s.GetDatabase(server$, path$) Set doc = db.GetDocumentByUNID(“9BA6204DE637239E48257C0C0007D310”) 'his subordinate’s leave form dateString = Cstr(Datevalue(doc.A_StartDate(0))) dateVar = doc.A_StartDate(0) pyear% = Year(dateVar) pmonth% = Month(dateVar) pday% = Day(dateVar) w = Datenumber ( pyear%, pmonth%, pday% + 1 ) Messagebox Cstr(doc.A_StartDate(0)),0 + 64, “Start Date” Messagebox dateString, 0+64, “Date String” Messagebox Cstr(w), 0+64, “Date Number”
Results:
A. User Settings: mm.dd.yyyy
-
10.22.13
-
00:00:00
-
10.23.13
B. User Setting: mm/dd/yyyy
-
10.22.13
-
00:00:00
-
10.23.13
Subject: It looks like you work for IBM
As I’m guessing D23DBL96/23/A/IBM is an internal IBM server.
As you’re IBM I figure it must be easier for you to out to your support group than for customers as partners, as it looks like you may have found a bug where the Mac isn’t honoring the OSs short date format.
Subject: No Workaround so far
Hi,
I have tried to raise this to other forums as well, but so far, there is no luck in finding a workaround on this matter.
Subject: Can you post the code you are using to get date etc.
Subject: Can you reproduce the issue…
…in IBM provided databases like mail database / Calendar?
Again: For Mac OS X 10.9.x. you should use the newest Notes version 9.0.1 FP1.