Wondering if anyone has encountered this before. ...
# advancedpdf
j
Wondering if anyone has encountered this before. We have a custom field of type “Date” on a record. When displaying it in Advanced PDF/HTML we need to format it so that it shows like November 8, 2024. Note that our default date formatting in NetSuite would be 8-Nov-2024. We are able to use a builtin to format the date as desired by using ${record.custbody_my_date_field?string[“MMMM dd, YYYY”]} HOWEVER if the date is Dec 31, it’s for some reason bumping to the next year? e.g. what shows in the record as 31-Dec-2024 is showing in the PDF as December 31, 2025.
j
Pretty sure this is related to time zones. I've seen this same type of thing in integrations where depending on the time of day it's showing a different date than in the UI. Basically you're gonna need to figure out what timezone it's working in and then what time zone it's displaying in and then get it to display the date for the timezone you want. Always a little tricky there, because both general and user-specific timezones can come into play, depending. I think this might help get you started fremarker-wise if you haven't perused this already: https://freemarker.apache.org/docs/ref_builtins_date.html
j
I tried changing to Dec 30 and same thing happened. But I changed YYYY to yyyy and it fixed it? So who knows.
j
bizarre. 🤷‍♂️
d
ran into this issue recently as well - here is the logic per suiteanswers: This is only happens for the convert days of the last days of December which will have have a January day(s) for the succeeding year. Using uppercase "YYYY" will return the week year value of the date. Using lowercase "yyyy" will return the calendar year. yyyy specifies the calendar year whereas YYYY specifies the year (of "Week of Year"), used in the ISO year-week calendar. In most cases, yyyy and YYYY yield the same number, however they may be different. Typically users should use the calendar year.
This year, Dec 29, 30, 31 fall into week 1 of 2025.
j
TIL. Never knew this was a thing. Lowercase forever, I guess 😆