Ticket #50 (closed defect: invalid)

Opened 21 months ago

Last modified 5 months ago

Extending Date object outside prototype

Reported by: pnp Owned by: zeank
Priority: normal Milestone: jsjac-1.3.2
Component: jsjac Version: 1.3
Severity: normal Keywords:
Cc: franck.tab@…

Description

in jsextras.js at line 30

Date.jab2date = function(ts) {

should be Date.prototype.jab2date = function(ts) {

The same goes for:

Date.hrTime = function(ts) {

at line 50 of the same file

Change History

Changed 21 months ago by zeank

  • status changed from new to assigned

Could you please eloborate this? Both methods are static so I don't see a reason why extend the objects prototype here. You usually don't want to call these on objects.

Changed 17 months ago by f.taby

Is this usage of jab2date is correct ?

var dt=new Date();
var dd=dt.jab2date(stamp); // stamp is coming from a xmpp message
var messageDate=new Date(dd);

Changed 17 months ago by f.taby

if yes, jab2date must be a prototype ?

Changed 17 months ago by f.taby

  • cc franck.tab@… added

adding me in cc:

Changed 13 months ago by zeank

  • status changed from assigned to closed
  • resolution set to fixed

No, it's

var converted = Date.jab2date(foo);

Changed 13 months ago by zeank

  • status changed from closed to reopened
  • resolution fixed deleted

Changed 13 months ago by zeank

  • status changed from reopened to closed
  • resolution set to invalid

Changed 6 months ago by sim

decoration Changed 1 year ago by admin

bathtub Changed 1 year ago by admin

solar system Changed 1 year ago by admin

stair parts Changed 1 year ago by admin

solar supply Changed 1 year ago by admin

Changed 5 months ago by bascorp

Note: See TracTickets for help on using tickets.