Skip to main content
Best answer

CLI: Transforming type date, numeric from inputData to correct formats

  • April 27, 2022
  • 1 reply
  • 110 views

Hey,

I’ve created some dynamic fields:
 

[
   {
      "key":"date",
      "label":"Date",
      "type":"datetime"
   },
   {
      "key":"number",
      "label":"Number",
      "type":"number"
   }
]

now datetime will be returned in ISO8601 but our API only allows dates in RFC 3339 format.
That’s why I want to transform the ISO8601 to RCF 3339 but in my “perform”-method I only receive in “bundle” the “inputData” but not the type of the fields.

Is there a way in which I can know in my “perform”-method of which fieldType the inputData is?
Something like:

{
   "inputData":{
      "date":{
         "type":"datetime",
         "value":"2022-04-27T11:11:27+02:00"
      },
      "number":{
         "type":"number",
         "value":6
      }
   }
}


 

Best answer by Development FlexmailBest answer by Development Flexmail

I’ve fixed it with https://moment.github.io/luxon/#/ . With this libary I can detect if a string is iso8601 and then transform this string into RFC 3339

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

I’ve fixed it with https://moment.github.io/luxon/#/ . With this libary I can detect if a string is iso8601 and then transform this string into RFC 3339