F24d9 custom time format (#473)

* fix password reset bug

* feat: time format in dat input

* fix lint issues

* fix time prefill, time format backend

* fix time format in OpenDate

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Favour Olayinka
2024-07-15 22:31:04 +01:00
committed by GitHub
parent 9a17787f76
commit 2a23c0a4f5
10 changed files with 37 additions and 10 deletions

View File

@@ -203,7 +203,9 @@ class FormSubmissionFormatter
$field['value'] = $data[$field['id']] ? 'Yes' : 'No';
} elseif ($field['type'] == 'date') {
$dateFormat = ($field['date_format'] ?? 'dd/MM/yyyy') == 'dd/MM/yyyy' ? 'd/m/Y' : 'm/d/Y';
$dateFormat .= (isset($field['with_time']) && $field['with_time']) ? ' H:i' : '';
if (isset($field['with_time']) && $field['with_time']) {
$dateFormat .= (isset($field['time_format']) && $field['time_format'] == 24) ? ' H:i' : ' g:ia';
}
if (is_array($data[$field['id']])) {
$field['value'] = isset($data[$field['id']][1]) ? (new Carbon($data[$field['id']][0]))->format($dateFormat)
. ' - ' . (new Carbon($data[$field['id']][1]))->format($dateFormat) : (new Carbon($data[$field['id']][0]))->format($dateFormat);