@@ -142,13 +142,28 @@ component {
142142 arguments .value = TimeFormat (local .value , ' tt' );
143143 }
144144 } else {
145- arguments .value = Evaluate ( " # local .item #( local.value) " );
145+ arguments .value = resolveDateTime ( local .item , local .value );
146146 }
147147 }
148148 if (local .firstDone ) {
149149 local .rv & = arguments .separator ;
150150 }
151- local .rv & = Evaluate (" $#local .item #SelectTag(argumentCollection=arguments)" );
151+ local .functionMap = {
152+ year : $yearSelectTag ,
153+ month : $monthSelectTag ,
154+ day : $daySelectTag ,
155+ hour : $hourSelectTag ,
156+ minute : $minuteSelectTag ,
157+ second : $secondSelectTag ,
158+ yearMonthHourMinuteSecond : $yearMonthHourMinuteSecondSelectTag ,
159+ ampm : $ampmSelectTag
160+ };
161+
162+ if (structKeyExists (functionMap , local .item )) {
163+ local .rv & = local .functionMap [local .item ](argumentCollection = arguments );
164+ } else {
165+ throw (" Invalid item value: " & local .item );
166+ }
152167 local .firstDone = true ;
153168 }
154169 return local .rv ;
@@ -186,7 +201,7 @@ component {
186201 if (arguments .twelveHour && arguments .$type IS " hour" ) {
187202 arguments .value = TimeFormat (arguments .$now , ' h' );
188203 } else {
189- arguments .value = Evaluate ( " # arguments .$type #( arguments.$now) " );
204+ arguments .value = resolveDateTime ( arguments .$type , arguments .$now );
190205 }
191206 }
192207
@@ -312,4 +327,23 @@ component {
312327 encode = local .encode
313328 );
314329 }
330+
331+ public numeric function resolveDateTime (required string dateTimeString , required date dateTimeValue ){
332+ switch (arguments .dateTimeString ) {
333+ case " year" :
334+ return Year (arguments .dateTimeValue );
335+ case " month" :
336+ return Month (arguments .dateTimeValue );
337+ case " day" :
338+ return Day (arguments .dateTimeValue );
339+ case " hour" :
340+ return Hour (arguments .dateTimeValue );
341+ case " minute" :
342+ return Minute (arguments .dateTimeValue );
343+ case " second" :
344+ return Second (arguments .dateTimeValue );
345+ default :
346+ throw (" Invalid type specified: " & arguments .dateTimeString );
347+ }
348+ }
315349}
0 commit comments