scala-java-locales
scala-java-locales copied to clipboard
SimpleDateFormat.format - NotImplementedError - escaping text fragment with single quotes
import java.util.Locale
val fmt = new java.text.SimpleDateFormat("[d MMM yyyy, HH:mm''ss.SSS] 'AudioFile' ", Locale.US)
fmt.format(new java.util.Date)
This throws NotImplementedError (???). Goes away when I remove the escaped fragment 'AudioFile'.
- https://scastie.scala-lang.org/0fjO9iLSSieLHc4we399cg
- https://scastie.scala-lang.org/dbmlsCXgQTOthZ13UtJJJQ (JVM - working)
The JDK docs are clear:
Text can be quoted using single quotes (') to avoid interpretation.
Also this rule is not followed:
"''"represents a single quote
instead they are presented as two single quotes.
Hi, this implementation of SimpleDateFormat is not really for production use, it is only a minimal set of stubs to make DateTimeFormatter work on scala-java-time. I'd discourage its direct use
Improvements are welcome of course if you want to fix its shortcomings