DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

James Moberg
James Moberg

Posted on

ColdFusion timeFormat Conversion Testing

I was prepping some tests for the awesome Lucee Spreadsheet library and came across an issue when one of my ID strings 9A was autocast as a time 09:00:00. I wasn't expecting this to happen as it didn't seem like a valid date/time string to me. I thought this could be easily fixed by adding a space 9 A and it was still converted to a time. How about multiple spaces 9 A... nope, it's still a valid time string?

Has anyone reviewed what valid and invalid strings the TimeFormat() tag can accept? I get different results when using Adobe ColdFusion versus Lucee... and that's a problem IMHO, but is it a bug or feature?

Adobe ColdFusion 2016 / 2018 Results:

"9" = NO "00:00:00.000"
"9A" = YES "09:00:00.000"
"9p" = YES "21:00:00.000"
"9#Chr(32)##Chr(32)##Chr(32)#A " = YES "09:00:00.000"
" 9 A " = YES "09:00:00.000"
"23" = NO "00:00:00.000"
"15.4" = YES "09:36:00.000"
Enter fullscreen mode Exit fullscreen mode

Lucee 5 Results:

"9" = false "00:00:00.000"
"9A" = false "ERROR"
"9p" = false "ERROR"
"9#Chr(32)##Chr(32)##Chr(32)#A " = false "ERROR"
" 9 A " = false "ERROR"
"23" = false "00:00:00.000"
"15.4" = true "00:00:00.000"
Enter fullscreen mode Exit fullscreen mode

Source Code

Top comments (0)

Stop sifting through your feed.

Find the content you want to see.

Change your feed algorithm by adjusting your experience level and give weights to the tags you follow.