sbstjn / timesheet.js

JavaScript library for HTML5 & CSS3 time sheets

Home Page:https://sbstjn.github.io/timesheet.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I use milliseconds as dates instead of years/months?

alexbilbie opened this issue · comments

Hello,

I want to build a profiler for my app - can I use this library will milliseconds instead of years/months?

Thanks

commented

It doesn't look like it. Date parsing appears to be very primitive. Perhaps I will try and fix this 😄 I would like this feature too.

Timesheet.prototype.parseDate = function(date) {
  if (date.indexOf('/') === -1) {
    date = new Date(parseInt(date, 10), 0, 1);
    date.hasMonth = false;
  } else {
    date = date.split('/');
    date = new Date(parseInt(date[1], 10), parseInt(date[0], 10)-1, 1);
    date.hasMonth = true;
  }

  return date;
};

What about minutes and hours? :P

I don't think I will add support for milliseconds. But as @nicksahler said, feel free to add it yourself, the date parsing is really not that complex ;)

I thought about milliseconds and profiler application right away as well. :)

By "add it" do you mean that it is customization possible on top of your code or it would have to be forked for that?