Skip to content

i18n and date formatting #391

Open
Open
@yoannfleurydev

Description

@yoannfleurydev

It could be great to handle date formatting with i18next and give example in the code

i18next
    .use(initReactI18next)
    .init({
        resources,
        lng: DEFAULT_I18N_LANGUAGE,
        interpolation: {
            escapeValue: false,
            format: (value, format) => {
                if (isDate(value)) {
                    return formatDate(value, format);
                }
                // List of custom formatters
                if (format === 'minutesToHours') {
                    return minutesToHours(value)?.toString();
                }
                return value;
            },
        },
    })
    "create_by": "{{displayName}} le {{date, dd MMMM yyyy}}"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions