Jump to content
We've recently updated our Privacy Statement, available here ×
  • Using Dec 31, 2021 (31-12-2021) as the date value in the date filter of the Ad Hoc displays a 1 year increment (Dec 31, 2022 / 31-12-2022) in the Ad Hoc data


    Dhiraj Pahlani
    • Features: Ad Hoc, Filters Product: JasperReports® Server

    Problem:
    When using Dec 31, 2021 (31-12-2021) as the date value in the date filter of the Ad Hoc, it displays an increment of 1 year (Dec 31, 2022 / 31-12-2022) in the Ad Hoc data.

    Cause:
    The error comes from the pattern expression we use in the adhoc_masks.properties file (<jasperserver-pro>/WEB-INF/bundles). When we format dates in Java, there is a subtle difference between YYYY (uppercase) and yyyy (lowercase). They both represent a year but yyyy (lowercase) represents the calendar year while YYYY (uppercase) represents the year of the week. That’s a subtle difference that only causes problems around a year change of the last week of the year.

    Solution:
    To display the date values correctly, follow below steps:

    1. Open the adhoc_masks.properties file (<jasperserver-pro>/WEB-INF/bundles) in an editor.

    2. Add below date format at the end of ADH_100_MASK_date_x, like:
    (Note: You may remove the format with YYYY (uppercase) from here if not required to avoid any future confusions. We can also just keep the first three formats, and it should work fine.)

    ADH_100_MASK_date_0 = medium,hide
    ADH_100_MASK_date_1 = short,hide
    ADH_100_MASK_date_2 = long,hide
    ADH_100_MASK_date_3 = dd-MM-yyyy

    3. Save the file, and restart the server for the changes to reflect.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...