vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Date view in combodate #585

Closed federicoco closed 7 years ago

federicoco commented 7 years ago

hello, I'm using angular Xeditable for my thesis. <a href="#" id="dataInizio" editable editable-combodate="risultato[0].data_inizio" data-pk="1" data-title="Quando è succcesso?">{{risultato[0].data_inizio }}</a>

where data_inizio is a date returned from a query in datetime format (2016-05-05 15:00:00) . I would like to display the date in this format (in the <a> tag ) 1 Febbraio 2016 15:00 where Febbraio is the month in italian . After I change the date it shows the changed date in this format 2015-03-01T04:00:00.000Z
so, my problems are :
1)Show in the a tag a localized italian date 2)when the date is changed, show it in a human comprensive way Can you please help me?

federicoco commented 7 years ago

I've managed to display it in a human comprensible way, but it is in english : if I want to change the locale to italian ?

ckosloski commented 7 years ago

You need to load the translations for moment.js also look here

federicoco commented 7 years ago

I've included the moment-with-locales.js and in the init function of angular(equivalent of $(function)), I wrote moment().locale('it');

github

if you see the attached images you will understand what I'm trying to achieve

ckosloski commented 7 years ago

Do you have Angular setup for i18n?

federicoco commented 7 years ago

no, what fix would you suggest me ?

ckosloski commented 7 years ago

You need to setup i18N for Angular. See this stackoverflow as an example

federicoco commented 7 years ago

hello sorry to annoy you, I've added the libraries like stackoverflow example suggested . The date is printed in italian locale only when is changed 1) underlined date : In english 2) popup combo date : months in english 3) Change date in Italian locale, but it does not update the old date How i manage to have all the date in italian locale ? (displayed date, months in italian ?)

ckosloski commented 7 years ago
  1. It sounds like Angular isn't setup for localization correctly. Maybe try this link
  2. It sounds like Moment is not setup for localization correctly if the combodate dropdown is in English. Did you set the locale for moment?
  3. Not sure about this, if everything is in english, how are you updating to Italian?

You might need to create a jsfiddle/plunker with your code if you want further specific help.

thienedits commented 7 years ago

Hello sorry to hijack this post but I have a question about the displayed datetime value. When testing locally on my machine the displayed valued is shown in UTC. Is this working as should? How do you get the displayed value to show in the users timezone?

thienedits commented 7 years ago

hmmm nvm, I don't think our api is correctly returning datetime in UTC format.

ckosloski commented 7 years ago

@thienedits should this issue be closed?

thienedits commented 7 years ago

Yes my issue has been resolved not sure about original post owner though.