Skip to content

Conversion support for java.time.YearMonth (as well as MonthDay) [SPR-13518] #18095

Closed

Description

@spring-projects-issues

Kazuki Shimizu opened SPR-13518 and commented

I hope to support the java.time.YearMonth class in type conversion service.

For example:

@RequestMapping("/timecards")
@Controller
public class TimecardController {
        @Autowired
        TimecardService timecardService;

	@RequestMapping(path = "{targetMonth}", method = RequestMethod.GET)
	public String viewDetail(@DateTimeFormat(pattern = "yyyyMM") @PathVariable YearMonth targetMonth, Model model) {
                Timecard timecard = timecardService.getTimecard(targetMonth);
		model.addAttribute(timecard);
		return "timecard/detail";
	}
}

How do think ?


Affects: 4.2.1

Issue Links:

Activity

  1. spring-projects-issues commented on Sep 28, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Indeed, in the Spring 4.3 timeframe, we should try to support YearMonth as well as MonthDay, not only in their Java 8 java.time incarnations but also with Joda-Time.

  2. spring-projects-issues commented on Nov 25, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    I'm considering this for 4.2.4 now, following up on #18294 / #11372 which deal with Period and Duration.

  3. added
    type: enhancement
    in: core
    on Jan 11, 2019
  4. added this to the 4.2.4 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions