I have a custom text field called "Actual start date" that is written like this format (Tue, Jan 16, 2024) and I want to write an automation that takes the text date and adds it to the Start Date field. I use the custom field ID number and I 've looked up that you have to change the format of the date field for it to show up in the Start Date field but everything I've tried the Start Date remains empty.
I'll use this {{issue.fields.customfield_10306}} and I receive an error that the formatting doesn't match the Start Date field (which is "yyyy-MM-dd"). So then I tried: {{issue.fields.customfield_10306.format("yyyy-MM-dd")}} which doesn't receive an error but the start date field remains blank. I read that a string can be converted to a date but is that possible? I've included a screenshot of the automation.
The format() function takes an object (like a date) and formats it as text: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---
Instead you want to take a text value and convert it to date type. Please try using toDate for that. As you have a non-standard format in that field, it would need the exact format specified. For example:
{{issue.customfield_10306.toDate("EEE, MMM dd, yyyy")}}
Please review the format() function's additional details to confirm the format matches what you need.
Kind regards,
Bill
Thank you for your help on this! For some reason using the code without the EEE part works but not with the EEE. The output is 2025-02-05T00:00:00.0+0000. Do you know how I can make that at least just look like this "Feb 05, 2025"? Would I need to create a variable and save the {{issue.customfield_10306.toDate("MMM dd, yyyy")}} to it then use the format function with the mediumDate format to make it fit the correct format as the Start Date field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To format a date in a particular text layout, please use the format() function, or one of the built-in formats.
To change the displayed format for a date field on an issue view, please check your profile settings and /or the site settings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.