@@ -21,7 +21,6 @@ import { QueryColumn } from '../../public/QueryColumn';
2121
2222import { TIME_RANGE_URI } from '../components/domainproperties/constants' ;
2323import { SelectInputOption } from '../components/forms/input/SelectInput' ;
24- import { ValueDescriptor } from '../components/editable/models' ;
2524
2625// These constants align with the formats declared in DateUtil.java
2726export const ISO_DATE_FORMAT_STRING = 'yyyy-MM-dd' ;
@@ -197,18 +196,17 @@ export function getDateFromISO(
197196 return parseDate ( value , undefined , minDate , false , queryColumn . isDateOnlyColumn ) ;
198197}
199198
200- export function formatDateTimeDisplayValueForUpdate ( vd : ValueDescriptor , queryColumn : QueryColumn ) : string {
201- const isoValue = vd ?. raw ;
202- if ( ! isoValue || typeof isoValue !== 'string' ) return null ;
203- const date = getDateFromISO ( isoValue , queryColumn ) ;
199+ export function getDateTimeDisplayValue ( date : Date , queryColumn : QueryColumn ) : string {
204200 const { dateFormat, timeFormat } = getPickerDateAndTimeFormat ( queryColumn , false , date ) ;
205- if ( queryColumn . isTimeColumn ) return formatTime ( isoValue , timeFormat ) ;
206- return formatDate ( date , null , dateFormat ) ;
201+ if ( queryColumn . isTimeColumn ) return formatTime ( date , timeFormat ) ;
202+ if ( queryColumn . isDateOnlyColumn ) formatDate ( date , null , dateFormat ) ;
203+ return formatDateTime ( date , null , dateFormat ) ;
207204}
208205
209- export function getTimeValueFromDatePickerInput ( date : Date , queryColumn : QueryColumn ) : string {
210- const { timeFormat } = getPickerDateAndTimeFormat ( queryColumn , false , date ) ;
211- return formatTime ( date , timeFormat ) ;
206+ export function getDateTimeDisplayValueFromStr ( isoValue : string , queryColumn : QueryColumn ) : string {
207+ if ( ! isoValue || typeof isoValue !== 'string' ) return null ;
208+ const date = getDateFromISO ( isoValue , queryColumn ) ;
209+ return getDateTimeDisplayValue ( date , queryColumn ) ;
212210}
213211
214212export function getColDateFormat ( column : QueryColumn , dateFormat ?: string , dateOnly ?: boolean ) : string {
@@ -739,7 +737,8 @@ export function formatDateTime(date: Date | string | number, timezone?: string,
739737export function formatTime ( timeValue : Date | string , timeFormat ?: string ) : string {
740738 const timeObj = parseTime ( timeValue ) ;
741739 if ( ! timeObj ) return undefined ;
742- return format ( timeObj , timeFormat ?? getDateFNSTimeFormat ( ) ) ;
740+ const _timeFormat = toDateFNSFormatString ( timeFormat ?? getDateFNSTimeFormat ( ) ) ;
741+ return format ( timeObj , _timeFormat ) ;
743742}
744743
745744// Issue 44398: see DateUtil.java getJsonDateTimeFormatString(), this function is to match the format, which is
0 commit comments