With the deprecation of faces managed beans in favour of CDI beans in Jakarta EE 10, the <managed-bean> solution doesn't (appear to) work.
In later versions, the below code defines a CDI bean which can inject a LocalDate for use as "#{currentDate}". The @Named annotation is optional, and it can be trivially modified to inject a java.util.Date for use with <f:convertDateTime> instead. See also the CDI spec's section on Producer methods (https://jakarta.ee/specifications/cdi/3.0/jakarta-cdi-spec-3.0.pdf, section 3.2).
import java.time.LocalDate;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Named;
@ApplicationScoped
public class CurrentDateBean {
@Produces
@Named("currentDate")
public static LocalDate getCurrentDate() {
return LocalDate.now();
}
}