jqueryjquery-globalize

Jquery Globalize dateformatter how to format months with leading zeros


When I look at the documentation I can't find a way to do this...but I have the following formatter:

Globalize.dateFormatter({skeleton: "yMd"});

And it produces dates like: 8/24/2015. What I would like is 08/24/2015.

Here is a fiddle: https://jsfiddle.net/xpy7Lxv3

Any advice?


Solution

  • i had a look in Docs , but i didn't find a format for dd/MM/yyyy , so added it as one format , try this

    Demo

    JS (I am just providing a part of code here, see demo)

    f = Globalize.dateFormatter({
        skeleton: "myFormat"
    });
    

    and data variable

    "dateTimeFormats": { 
        "medium": "{1}, {0}",
            "availableFormats": {    
                "myFormat": "dd/MM/yyyy",
                // other formats
            }
    }
    

    now use can use whatever the format (only valid format) you want in myFormat and you are free to change the name of myFormat.