@@ -100,6 +100,17 @@ trait LegacyDateFormatter extends DateFormatter {
100100 }
101101}
102102
103+ /**
104+ * The legacy formatter is based on Apache Commons FastDateFormat. The formatter uses the default
105+ * JVM time zone intentionally for compatibility with Spark 2.4 and earlier versions.
106+ *
107+ * Note: Using of the default JVM time zone makes the formatter compatible with the legacy
108+ * `DateTimeUtils` methods `toJavaDate` and `fromJavaDate` that are based on the default
109+ * JVM time zone too.
110+ *
111+ * @param pattern `java.text.SimpleDateFormat` compatible pattern.
112+ * @param locale The locale overrides the system locale and is used in parsing/formatting.
113+ */
103114class LegacyFastDateFormatter (pattern : String , locale : Locale ) extends LegacyDateFormatter {
104115 @ transient
105116 private lazy val fdf = FastDateFormat .getInstance(pattern, locale)
@@ -108,6 +119,22 @@ class LegacyFastDateFormatter(pattern: String, locale: Locale) extends LegacyDat
108119 override def validatePatternString (): Unit = fdf
109120}
110121
122+ // scalastyle:off line.size.limit
123+ /**
124+ * The legacy formatter is based on `java.text.SimpleDateFormat`. The formatter uses the default
125+ * JVM time zone intentionally for compatibility with Spark 2.4 and earlier versions.
126+ *
127+ * Note: Using of the default JVM time zone makes the formatter compatible with the legacy
128+ * `DateTimeUtils` methods `toJavaDate` and `fromJavaDate` that are based on the default
129+ * JVM time zone too.
130+ *
131+ * @param pattern The pattern describing the date and time format.
132+ * See <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">
133+ * Date and Time Patterns</a>
134+ * @param locale The locale whose date format symbols should be used. It overrides the system
135+ * locale in parsing/formatting.
136+ */
137+ // scalastyle:on line.size.limit
111138class LegacySimpleDateFormatter (pattern : String , locale : Locale ) extends LegacyDateFormatter {
112139 @ transient
113140 private lazy val sdf = new SimpleDateFormat (pattern, locale)
0 commit comments