Primefaces calendar component show only month and year

后端 未结 12 1877
南笙
南笙 2020-12-14 03:25

primefaces calendar component is getting Date by default. Can I get only month and year without dates.

How to get only month and year

12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 03:34

    The last release of Primefaces (Version 7.0) has just added what you need: the . It works almost exactly as a but it can be easily configured to show only months and years:

    
    

    For example, when a month is selected, its value is stored in a "Date" object, which will have the value:
    (If April of 2019 is selected) Mon Apr 01 00:00:00 BRT 2019
    In this case, you would just have to ignore the day, hour, minute, etc values and use the month and year selected.
    For more information, read the Documentation and see the Showcase

提交回复
热议问题