@@ -109,4 +109,58 @@ public function minutesAvailable(array $minutes): static
109109 {
110110 return $ this ->opts (['minutesAvailable ' => $ minutes ]);
111111 }
112+
113+ /**
114+ * The format of the date string loaded from the server for the field's
115+ * value and also for sending to the server on form submission.
116+ * The formatting options are defined by Moment.js.
117+ *
118+ * @param string $format
119+ * @return $this
120+ * @see https://editor.datatables.net/reference/field/datetime#Options
121+ * @see https://momentjs.com/docs/#/displaying/format/
122+ */
123+ public function wireFormat (string $ format = 'YYYY-MM-DDTHH:mm:ss.000000Z ' ): static
124+ {
125+ $ this ->attributes ['wireFormat ' ] = $ format ;
126+
127+ return $ this ;
128+ }
129+
130+ /**
131+ * Allow (default), or disallow, the end user to type into the date / time input element.
132+ * If disallowed, they must use the calendar picker to enter data. This can be useful
133+ * if you are using a more complex date format and wish to disallow the user from
134+ * potentially making typing mistakes, although note that it does also disallow
135+ * pasting of data.
136+ *
137+ * @param bool $state
138+ * @return $this
139+ * @see https://editor.datatables.net/reference/field/datetime#Options
140+ */
141+ public function keyInput (bool $ state = true ): static
142+ {
143+ $ this ->attributes ['keyInput ' ] = $ state ;
144+
145+ return $ this ;
146+ }
147+
148+ /**
149+ * The format of the date string that will be shown to the end user in the input element.
150+ * The formatting options are defined by Moment.js. If a format is used that is not
151+ * ISO8061 (i.e. YYYY-MM-DD) and Moment.js has not been included, Editor will
152+ * throw an error stating that Moment.js must be included for custom
153+ * formatting to be used.
154+ *
155+ * @param string $format
156+ * @return $this
157+ * @see https://editor.datatables.net/reference/field/datetime#Options
158+ * @see https://momentjs.com/docs/#/displaying/format/
159+ */
160+ public function displayFormat (string $ format = 'YYYY-MM-DD hh:mm a ' ): static
161+ {
162+ $ this ->attributes ['displayFormat ' ] = $ format ;
163+
164+ return $ this ;
165+ }
112166}
0 commit comments