Roland Collins said the following on 2/27/2006 11:40 PM: > Date formatting is display logic, and therefore belongs in your display > layer. As long as the data layer returns a type of "date" (or something > resembling one CF since CF is type-less), it's up to your display layer how > it is to be formatted. > > To draw a parallel, you wouldn't think twice about returning a dollar value > of "3000" from an Product.getValue() call. But when you display that value, > you'll likely want to add a currency sign and maybe some place denotation, > so it looks like "$3,000.00". You obviously wouldn't want to put the > formatting to add the dollar sign, comma, and decimals in the getter for a > price, otherwise it's useless in calculations since it would be a string and > not a number. So why would you do that for a date? Dates are a (pseudo) > low level data type just like numbers, after all - at least as far as CF is > concerned :) > > RC > Here here!
Things like date formatting, price formatting etc. all belong in your view. As Rob Munn mentions in the next email this thread, I typically have some sort of UI service layer. Widgets that do things like format a date the application standard (then my view doesn't need access to the correct mask), obfuscate an email address by truncating the domain or build drop downs with data (like countries or states). -- Peter J. Farrell :: Maestro Publishing Member Team Mach-II :: Member Team Fusion http://blog.maestropublishing.com Create boilerplate beans and transfer objects for ColdFusion! Fire up a cup of Rooibos! http://rooibos.maestropublishing.com/ ---------------------------------------------------------- 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]
