Title: Message
Correct.
What do you want to happen if an empty date it provided?
you could go:
<cfargument name="myDateTime" type="string" required="false" default="">
Then have a
<cfif NOT len(arguments.date)>
    <cfset arguments.date = [your default date]>
</cfif>
 
In saying that, I think it is fine to have a function that breaks if it is called incorrectly, as all functions break if you call them wrong.
With out understand your requirements for the function, could you do some validation on the calling code.
EG.
<cfif len(myDateValue)>
    <cfset sThisDate = oMyCFC.dateOutput(myDateValue)>
</cfif>
 
HTH
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Phillip Senn
Sent: Wednesday, 24 May 2006 9:28 a.m.
To: [email protected]
Subject: [CFCDev] Easy question

<cfcomponent displayname="DateTime" output="false">
<cffunction name="DateOutput" returntype="string" hint="I return the date
formatted for output" output="false">
<cfargument name="myDateTime" type="date" required="yes">
<cfset var result = "">
<cfif DateDiff('d','1/1/1900',myDateTime) GT 0>
        <cfset result = DateFormat(myDateTime,"yyyymmdd")>
</cfif>
<cfreturn result>
</cffunction>



This works fine, except it doesn't accept an empty myDateTime.
So I suppose I need to change type="date" to type="string".

But then I'll need to verify that myDateTime is either "" or a valid date.




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]


This email contains confidential information. If you are not the
intended recipient of this email, please notify Straker Interactive 
and delete the email. You are not entitled to use it in any way. ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to