echo CarbonInterval::fromString('1yr 1mo 3w 3d 14h 23m 57s');
Carbon version: 2.41.5
PHP version: 7.2.34
I expected to get:
1 year 1 month 3 weeks 3 days 14 hours 23 minutes 57 seconds
But I actually get:
Carbon\Exceptions\InvalidIntervalException
Invalid part 1yr in definition 1yr 1mo 3w 3d 14h 23m 57s
Thanks!
My work-around at the moment is to add case for 'yr, yrs and mos' to the CarbonInterval fromString() function.
The time string '1yr 1mo 3w 3d 14h 23m 57s' was generated from CarbonInterval using the forHumans() function with ['short' => true].
I searched the file CarbonInterval looking for 'yr' and 'mos' as well to see where those came from but there are no hits for those.
Hello,
I encountered an issue with the following code:
Carbon version: 2.41.5
PHP version: 7.2.34
I expected to get:
But I actually get:
Thanks!
My work-around at the moment is to add case for 'yr, yrs and mos' to the CarbonInterval fromString() function. The time string '1yr 1mo 3w 3d 14h 23m 57s' was generated from CarbonInterval using the forHumans() function with ['short' => true]. I searched the file CarbonInterval looking for 'yr' and 'mos' as well to see where those came from but there are no hits for those.