[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

I can not save dates

luisruiz.figueroa

3/3/2015 5:41:00 PM

in many applications can not save data containing dates or times, in my view the directive shows me a good date format, but when saving the data format changed for another.


json ng-model Actividad: {"Nombre":act1,"Fecha":"2015-03-03T03:00:00.000Z","Hora":"1970-01-01T03:00:00.000Z","observacion":"obs"}

<input type="text" ng-model="Actividad.Nombre" placeholder="Nombre de actividad">
<input ng-model="Actividad.Fecha" type="date" >
<input ng-model="Actividad.Hora" type="time" >
<textarea ng-model="Actividad.observacion" placeholder="Observación"></textarea>

<ons-button modifier="large" ng-click="addTodo(Actividad)" ></ons-button>




from my debugger I can visualize this

Actividad: Object
Fecha: Tue Mar 03 2015 00:00:00 GMT-0300 (Hora estándar de Argentina)
__proto__: Invalid Date
Hora: Thu Jan 01 1970 00:00:00 GMT-0300 (Hora estándar de Argentina)
__proto__: Invalid Date
Nombre: "act1"
observacion: "obs"
2 Answers

ram

3/3/2015 10:53:00 PM

0

luisruiz.figueroa@gmail.com writes:
>in many applications can not save data containing dates or
>times, in my view the directive shows me a good date format,
>but when saving the data format changed for another.

I cannot really understand the rest of your post, so I
only respond to the above, using experiences from other
programming languages:

Wild guess: First, explicitly convert all data to strings.
Then, view those strings in the debugger and, finally,
save those strings.

JR

3/4/2015 12:02:00 PM

0

On 03/03/2015 14:40, luisruiz.figueroa@gmail.com wrote:
> in many applications can not save data containing dates or times, in
> my view the directive shows me a good date format, but when saving
> the data format changed for another.
>
>
> json ng-model Actividad:
> {"Nombre":act1,"Fecha":"2015-03-03T03:00:00.000Z","Hora":"1970-01-01T03:00:00.000Z","observacion":"obs"}
>
> <input type="text" ng-model="Actividad.Nombre" placeholder="Nombre
> de actividad"> <input ng-model="Actividad.Fecha" type="date" > <input
> ng-model="Actividad.Hora" type="time" > <textarea
> ng-model="Actividad.observacion"
> placeholder="Observación"></textarea>
>
> <ons-button modifier="large" ng-click="addTodo(Actividad)"
> ></ons-button>
>
>
>
>
> from my debugger I can visualize this
>
> Actividad: Object Fecha: Tue Mar 03 2015 00:00:00 GMT-0300 (Hora
> estándar de Argentina) __proto__: Invalid Date Hora: Thu Jan 01 1970
> 00:00:00 GMT-0300 (Hora estándar de Argentina) __proto__: Invalid
> Date Nombre: "act1" observacion: "obs"
>

You'd better ask about AngularJS on an AngularJS Forum:
<https://groups.google.c...!forum/angular>

--
Joao Rodrigues