I am currently utilizing Automaton for Jira LITE to handle incoming issues from emails. In the issue description, there is a date in a form of a string which I extract with a regex using match(). I can convert the string into a date object using .toDate. However, the converted object is not the correct date.
For example, one of the descriptions has a date of "September 3, 2019". I used .toDate("MMMM d, YYYY") to convert it to a date object with the correct format. I then format that date further to .format("d/MMM/yy"). It should spit out 3/Sep/19. The actual output is 30/Dec/18. When put it into a different format like yyyy-mm-dd, it spits out 2018-00-30. I've also tried changing the month in the description in July, same result. My guess is that my string format may cause Automation to read it incorrectly.
Could this be related to how I've extracted the string via regex from the description? Should I try formatting the extracted string in a certain way so Jira/Automation can read it correctly?