How to reset date in .set

How to reset date in .set

SunilgoelSunilgoel Posts: 48Questions: 19Answers: 0

Hi ,
$('#packageaccounttable').on( 'click','#setrowempty', function (e) {
editor
.edit( $(this).closest('tr'), false )
.set ('particular','')
.set ('purchase_amt',0)
.set ('sale_amt',0)
.set ('remarks','')
.set ('vendor','')
.set ('booking_date','0')
.set ('payment_date','0')
.set ('payment_mode','')
.set ('booking_id','')
.set ('payment_made','')
.set ('voucher_issued','N')
.submit();
} );

in above example every columns is initializing except booking_date and payment_date.

after sumit shows 01-01-1970

should be 00-00-0000

How to do this.

Regards.
Sunil

Answers

  • allanallan Posts: 64,596Questions: 1Answers: 10,683 Site admin

    Hi Sunil,

    Try new Date().

    Allan

  • johnstewart497johnstewart497 Posts: 2Questions: 0Answers: 0

    Wow, Allan, thanks for the tip)

  • SunilgoelSunilgoel Posts: 48Questions: 19Answers: 0

    Hi Allan,

    new Data() set as Current Date , i want to initialize date so that show 00-00-0000 or 0000-00-00.

    Regards.
    Sunil

  • allanallan Posts: 64,596Questions: 1Answers: 10,683 Site admin

    I don't think its possible to represent 0000-00-00 with the Date object. Trying new Date(0,0,0) results in Sun Dec 31 1899 00:00:00 GMT+0000 (GMT).

    If you use a formatted field with moment.js it should be possible to set the value that way and I think moment will probably cope with dates prior to 1900.

    Allan

This discussion has been closed.