Class LocalDateTimeToDateConverter

    • Constructor Detail

      • LocalDateTimeToDateConverter

        public LocalDateTimeToDateConverter​(ZoneId zoneId)
        Creates a new converter using the given time zone.
        Parameters:
        zoneId - the time zone to use, not null
    • Method Detail

      • convertToModel

        public Result<Date> convertToModel​(LocalDateTime localDate,
                                           ValueContext context)
        Description copied from interface: Converter
        Converts the given value from presentation type to model type.

        A converter can optionally use locale to do the conversion.

        Specified by:
        convertToModel in interface Converter<LocalDateTime,​Date>
        Parameters:
        localDate - The value to convert. Can be null
        context - The value context for the conversion.
        Returns:
        The converted value compatible with the source type
      • convertToPresentation

        public LocalDateTime convertToPresentation​(Date date,
                                                   ValueContext context)
        Description copied from interface: Converter
        Converts the given value from model type to presentation type.

        A converter can optionally use locale to do the conversion.

        Specified by:
        convertToPresentation in interface Converter<LocalDateTime,​Date>
        Parameters:
        date - The value to convert. Can be null
        context - The value context for the conversion.
        Returns:
        The converted value compatible with the source type