To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=65555
                  Issue #:|65555
                  Summary:|Basic function does not accept variants
                Component:|framework
                  Version:|OOo 2.0.2
                 Platform:|All
                      URL:|
               OS/Version:|Unix, X11
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|PATCH
                 Priority:|P4
             Subcomponent:|scripting
              Assigned to:|mba
              Reported by:|villeroy





------- Additional comments from [EMAIL PROTECTED] Thu May 18 12:24:28 -0700 
2006 -------
The following fails at last step because Date2ISO insists on getting an object.
Surprisingly boolean TestStruct(v) works fine:
Sub Main
Dim oDt as new com.sun.star.util.Date
oDt.Year = 2000
oDt.Month = 12
oDt.Day =31
print TestStruct(oDt)
print TestStruct(0)
print IsoFromDateStruct(oDt)
print IsoFromDateValue(39000)
print Date2ISO(oDt)
print Date2ISO(39000)
End Sub
Function TestStruct(v)as boolean
Dim bResult as Boolean
If isUnoStruct(v) then
        bResult= true
Else
        bResult = false
EndIf
TestStruct = bResult
End Function

Function Date2ISO(vDt) as String
'conversion to basic-date dtVal
If isUnoStruct(vDt)Then 'object/UNO-struct
  dtVal = dateSerial(vDt.year,vDt.month,vDt.day)
Else
  dtVal = cDate(vDt)
End If
        sDt = cDateToISO(cDate(dtVal))
        Date2ISO = left(sDt,4)&"-"& mid(sDt,5,2)&"-"& right(sDt,2)
End Function


'pass a number or date-string
Function IsoFromDateValue(vDt)as string
Dim sDt$
        sDt = cDateToISO(cDate(vDt))
        IsoFromDateValue = left(sDt,4)&"-"& mid(sDt,5,2)&"-"& right(sDt,2)
End Function
'pass an UNO-struct com.sun.star.util.Date or DateTime.
Function IsoFromDateStruct(oDt as Object)as string
Dim dtVal as Date
        If isUNOStruct(oDt) then
                dtVal = DateSerial(oDt.Year,oDt.Month,oDt.Day)
                IsoFromDateStruct = IsoFromDateValue(dtVal)
        endif
End Function

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to