Skip to content

Wrong result when call $monent(%.a).utc() #737

@liguangbo

Description

@liguangbo

When I use the $moment function to process parent fields, there is no issue simple invocation. However, I subsequently call utc() function on $moment result, it returns current time.

I think the test2 should be 2021-01-02T11:00:12.000Z

original data

{
  "createdDate": "2021-01-02T11:00:12Z",
  "a": {
    
  }
}

jsonata

(

    a.(
        $m := $moment(%.createdDate);
        {
            "test": %.createdDate,
            "test1": $moment(%.createdDate),
            "test2": $moment(%.createdDate).utc(),
            "test3": $m.utc()
        }
    )
)

external libary

moment      https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions