Need a special offer?Find out if your project fits.
+

month name from numeric

Answered
Michael T asked on April 18, 2022

Is there a way to display numeric month with string names?
e.g. 01 => January 
if so, how can we define language, and how can we do short forms? (e.g. Jan)
 
thank you

3 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster April 20, 2022

Hello, Michael!

Thank you for writing to us.

Our team wants to inform you that there are several ways to format months' names from the date fields for JSON and CSV data sources.

1. The following approach is used when you need to set one default date format for all date fields in Flexmonster.

The datePattern option is applied for all columns with the date string data type. Also, we used defaultDateType property with date string value. That makes Flexmonster treat all the date columns as date string.

report:{
options: {
defaultDateType: "date string",
datePattern: "dd MMM YYYY"
}
slice: {...}
}

You can try this approach on jsFiddle: https://jsfiddle.net/flexmonster/x41q3m7v/

2. If you need to format dates only for the specific column, we recommend defining date formats in the mapping property of the dataSource object:

dataSource:{
   filename:{...},
   mapping: {
      "Date": {
         uniqueName:"Date String",
         type:"date string",
         format:"dd MMM YYYY"
      }
   }
}

We have prepared a simple example for visualization: https://jsfiddle.net/flexmonster/zLu1p639/
For more details, please look through our docs on this topic: https://www.flexmonster.com/doc/date-and-time-formatting

How to define the language
You can specify the localization for all months' names in the language you want. Here's our localization guide: https://www.flexmonster.com/doc/localizing-component/

Please let us know if it works for you. Feel free to contact us if any further questions arise.

Regards,
Solomiia.

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster April 27, 2022

Hello, Michael!
 
Hope you are doing well.
 
Our team is wondering if you had a chance to try the suggested month formatting approaches. Could you please let us know if our response helped?
 
Looking forward to hearing from you.
 
Regards,
Solomiia.

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster May 5, 2022

Hello, Michael!
 
Hope you are having a great week.
 
Just checking in to ask if our response helped you with your question.
 
We will be glad to hear your feedback.
 
Regards,
Solomiia

Please login or Register to Submit Answer