protected TemporalAccessor getFormattableObject ( Object value , Locale locale , TimeZone timeZone , MustacheTagInfo tagInfo ) { if ( value instanceof TemporalAccessor ) { return ( TemporalAccessor ) value ; } else if ( value instanceof Date ) { return LocalDateTime . ofInstant ( ( ( Date ) value ) . toInstant ( ) , timeZone . toZoneId ( ) ) ; } else if ( value instanceof Calendar ) { return LocalDateTime . ofInstant ( ( ( Calendar ) value ) . toInstant ( ) , timeZone . toZoneId ( ) ) ; } else if ( value instanceof Number ) { return LocalDateTime . ofInstant ( Instant . ofEpochMilli ( ( ( Number ) value ) . longValue ( ) ) , timeZone . toZoneId ( ) ) ; } else { throw valueNotAFormattableObject ( value , tagInfo ) ; } }
should be safe