Luis Majano Forums Notification: Post to Datetime odd issue

Title: RE: Datetime odd issue
Thread: Datetime odd issue
Forum: Need Help?
Conference: ColdBox
User: lmajano

Hi tyman,

This is an issue more dealing with Transfer. You can read more on
this at the Transfer google group. http://groups.google.com/group/transfer-dev
However, I have dealt with this issue in the past. Please see:
http://www.transfer-orm.com/transfer/documentation/null.html
It shows you what
are the default null values Transfer uses on its objects. What I recommend you
do, is create a decorator for the contact object and create two methods for the
dLastLogin: getdLastLogin and setdLastLogin, where each take a string as their
input. I am providing a sample below:

[code]
<cffunction
name="getdLastLogin" output="false" access="public" returntype="string">
<cfset var endDate = "">
  <cfif not getTransferObject().getdLastLoginIsNull()>
<cfset endDate = dateFormat(getTransferObject().getdLastLogin(),
getDateFormat())>
  </cfif>
  <cfreturn endDate>
</cffunction>
<cffunction
name="setdLastLogin" output="false" access="public" returntype="void"
hint="Set the date if found.">
  <cfargument name="myDate" type="string"
required="false" default=""/>
  <cfif isDate(arguments.mydate)>
    <cfset
getTransferObject().setdLastLogin(arguments.mydate)>
  <cfelse>
    <cfset
getTransferObject().setdLastLoginNull()>
  </cfif>
</cffunction>
[/code]
A part from this, you need to note when the dLastLogin will be null: on insert
or update. Also, you populate the bean using the beanfactory as you show in your
code. But if a value for "dLastLogin" does not exist in the request collection,
the value will not be populated.

I usually set values like this manually. For
example, when a user logs in, I say:
[code]
tObj.setdLastLogin(now())
[/code]
I hope this works and you can understand why you are getting the error

http://www.luismajano.com/forums/index.cfm?event=ehMessages.dspMessages&threadid=3E8F2705-123F-6116-424D9B72A7E31E67