Display month as text and not as number

Hello,
I have created again a post with a similar title but is closed and need to refresh something into the code probably.

@uamv he mention this code, https://snippet.farm/code/replace-numbered-months-with-named-months-in-date-field/
but if you choose a previous month it will display the month as number, why?
check it out yourself

I’m not able to reproduce any issue when visiting that page.

1 Like

just select a month and you will see it will displayed as number and not as text

Hello, i am trying to display month on a date drop down field as TEXT(e.g. January) and not as NUMERIC(1),
how i can achieve this?

Hey,
anyone can update me?
Some clients are choosing past dates and this is so wrong because my client doing trips and tours according to specific todays.
So i have to change all twelve months to text immediatly.
Thanks

As mentioned, all appears fine when I view this form…

Could it be that users are only encountering this is some specific browser?

Please choose a month and then just press the NEXT button bellow, you will see that the month names will dissapear and will appear numbers instead of text.
thats the issue

the code can be modified to include all twelve named months in its array. This can be done by adding the missing named months to the existing array or by creating a new array with all twelve named months and using it instead.

The months are already listed into the date drop down,
the problem is if you select a month and press NEXT button the month you selected will change to number. ( Get a Quote - Kefalonia Taxi Service - Call Now )
also tried this code this no luck

jQuery(function($) {
    let select_id = 'input_1_21_1'; // Change this
    let select_month_options = $('#' + select_id + ' option');
    let month_names = { '1': 'januari', '2': 'februari', '3': 'maart', '4': 'april', '5': 'mei', '6': 'juni', '7': 'juli', '8': 'augustus', '9': 'september', '10': 'oktober', '11': 'november', '12': 'december' };
    $.each( select_month_options, function( key, option ) {
        let value = option.value;
        if ( month_names[value] ) {
            option.label = month_names[value];
        }
    });
    
    $('#' + select_id).change(function() {
        let selected_month_name = $(this).find(':selected').text();
        $('#selected_month_name').text(selected_month_name);
    });
});
</script>

<select id="input_1_21_1">
    <option value="1">Januari</option>
    <option value="2">Februari</option>
    <option value="3">Maart</option>
    <option value="4">April</option>
    <option value="5">Mei</option>
    <option value="6">Juni</option>
    <option value="7">Juli</option>
    <option value="8">Augustus</option>
    <option value="9">September</option>
    <option value="10">Oktober</option>
    <option value="11">November</option>
    <option value="12">December</option>
</select>

<p>You selected month name: <span id="selected_month_name"></span></p>```

anyone could help me?

OK i managed to fix this ,
i would like to change the client & admin notification email ,
about the date format on the email notification.
Change it from (e.g. 28/4/2023) to e.g. 28/april/2023

My client notification settings.
What should i change?

Thanks for your email,

{all_fields:dow}

&nbsp;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.