vendredi 26 février 2016

Ember Date get Month, Year, and Day

I've searched around but I couldn't find any help.

I want to know if I can get the Day, Month, and Year, and maybe other attributes, from Ember's Date attribute.

For example, in one of my models, I have something like this:

createdAt: DS.attr('string', {
    defaultValue() {
        return new Date();
    }
})

which returns me this format: Tue Feb 23 2016 10:27:10 GMT-0800 (PST)

Is there a way which I can get the "Feb" portion from the whole Date?

I know in pure JS, you can do something like var today = new Date.getMonth(), but that doesn't work, of course, for Ember's date.

Thank you.




Aucun commentaire:

Enregistrer un commentaire