The smart value function shortTime returns a different character code

XMLWordPrintable

    • Minor
    • Jira Software, Jira Service Management, Jira Work Management, Jira Product Discovery, Confluence, Bitbucket

      Problem

      When using the function .shortTime, it returns a different space character code, which causes issues when using conditions.

      Steps to Reproduce

      1. Create an automation rule
      2. Add a smart value condition
      3. The First value should use a smart value with .shortTime at the end, i.e.:
        {{now.withMinute(0).shortTime}}
        
      4. Compare this with the current hour like 4:00 AM.
      5. Run the automation rule

      Expected Results

      The two values should be equal, satisfying the condition.

      Actual Results

      The condition fails as the type of space character differs between the two values.

      Workaround

      You can use the .format function to get the correct space char code:

      {{now.convertToTimeZone("America/Montreal").withMinute(0).format("h:mm a")}}
      

      You can also copy and paste in a " " (narrow, no-break space character) into the second value like 4:00 AM.

      Notes

      The .shortTime smart value returns a character code 8239 (narrow, no-break space character) rather than 32 (no-break space character). This causes a bug when using the condition and manually typing the space using your keyboard.

      Verifying the smart value output generates the following result:

      Input: 10:00 AM
      Output: 49, 48, 58, 48, 48, 8239, 65, 77
      

      Manually writing the same value results in the following:

      Input: 10:00 AM
      Output: 49, 48, 58, 48, 48, 32, 65, 77
      

            Assignee:
            Unassigned
            Reporter:
            David Lima (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: