Skip to content

Multiple relative times and day after tomorrow/day before yesterday in PrettyTime #920

@Barachia

Description

@Barachia

Hi MenoData,

Great library with support! I had a couple of questions.

import net.time4j.PrettyTime;
import java.time.ZonedDateTime;
import java.util.Locale;

....

ZonedDateTime time = ZonedDateTime.now().plusDays(2).withHour(23);
System.out.println(PrettyTime.of(Locale.forLanguageTag("en")).printRelative(ZonedDateTime.from(time)));

The result would now be "last [nameOfWeekDay]", but it would be nice to have "day before yesterday".

  • Would it be possible/good to have an extra method in the PrettyTime class for 'day before yesterday' and 'day after tomorrow'?

  • Is it possible to get a list of possible PrettyTime relatives instead of the one? So in the example above, you might get both "last [nameOfWeekDay]" and "day before yesterday". The same could go for saying something happened "last month", "1 month ago" or "last [nameOfMonth]".

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions