dateformat incorrectly parsing date with leading 0's?

Description

Noticed an error in one of our tests when using the year function. It looks like date format is incorrectly parsing a date string with leading 0’s. 2024-09-09 is being parsed as 2024-00-09 so when using a subsequent date function it fails with “Can’t cast [2024-00-09] to a DateTime”.

dateToAnalyse = "2024-09-09".dateFormat( "yyyy-mm-dd" ); writedump(dateToAnalyse); year1 = Year(date=dateToAnalyse);

Activity

Show:

Jon Clausen September 19, 2024 at 1:40 PM

Ah! I there was an issue with the order that the masks were being updated, resulting in that becoming dd-MMm-yyyy I have pushed the fix.

Doug Cain September 18, 2024 at 1:31 PM

test = Dateformat(Now(),'dd-mmm-yyyy'); writedump(test);

bx-compat shows “18-0924-2024” with dd-MMM-yyyy it shows “18-Sep-2024”

Jon Clausen September 18, 2024 at 12:55 PM

could you send me a code sample of the way you are using it? There is an test for that mask that is solid https://github.com/ortus-boxlang/bx-compat/blob/development/src/test/java/ortus/boxlang/modules/compat/bifs/temporal/DateTimeFormatTest.java#L76

Doug Cain September 18, 2024 at 10:10 AM

looks like mmm isn't working in the current bx-compat module

Jon Clausen September 12, 2024 at 2:32 PM

I've added additional handling in to the compat module. All datetime BIFs which accept mask or format arguments now pass through an interception, once the compat module is installed to handle the legacy masks.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created September 9, 2024 at 11:27 AM
Updated September 19, 2024 at 1:40 PM
Resolved September 12, 2024 at 2:32 PM

Flag notifications