Need a datepicker; build my own or use someone else's?

TridenT

Lifer
Sep 4, 2006
16,800
45
91
I'm using jQuery and Bootstrap. I need a date picker to choose dates easily on a form. There just so happens to be Bootstrap 3 datetimepicker. ( http://eonasdan.github.io/bootstrap-datetimepicker/ ) It's nice and all but it uses Moment.js (with its Locales) in addition. It's not just jQuery + Bootstrap (Bootstrap requires jQuery). Right now, my project only has the jQuery and Bootstrap libraries added to it. I'll be adding D3.js soon enough and I don't want to add a bunch of libraries to my project unless I'm using them extensively.

To me, that was the point where I started to question whether or not I should just make my own date picker.

Benefits of making my own date picker:

  • I could make another github project out of it. (More the merrier, right?) I only have one project on github right now and it's the one I am working on.
  • I could make one that doesn't require another large library.
  • Potentially could have my code used by quite a few people who are looking for something similar.

Downsides:

  • It will take a lot more time than using the premade option. A lot more.
  • Who cares?

Thoughts?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Honestly I don't see how anyone can answer this question for you. You'll use a pre-built one if it fits all your needs and making a custom one doesn't add enough value to be worthwhile.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
I wouldn't pull multiple libraries into your project. Find one that works with jQuery and use it. You can probably find one that you can style to your liking.

Creating your own date picker is going to be a lot of work. Just thinking about the internationalization process is unpleasant (hint, it's a lot more than just translations).
 

TridenT

Lifer
Sep 4, 2006
16,800
45
91
if you are using jquery, why don't you use the datepicker that is included with jquery-ui?

http://jqueryui.com/datepicker

recreating the wheel is a terrible idea, use one of the tons of them out there that have already been used and tested by many.

EDIT:

or this one that is more bootstrap'ish.

http://www.eyecon.ro/bootstrap-datepicker/

From what I understand, jQuery UI is a separate library from jQuery. So, that would be why.

Whatever though guys, I added moment+locales.js, underscore.js (I needed a good throttle function), the datepicker I linked to, and will add d3.js soon enough. Right now, I think optimization can come later. I just need to get this thing working. I don't need to spend so much time pre-optimizing when the page isn't crushingly slow on anything.
 

purbeast0

No Lifer
Sep 13, 2001
53,543
6,368
126
From what I understand, jQuery UI is a separate library from jQuery. So, that would be why.

Whatever though guys, I added moment+locales.js, underscore.js (I needed a good throttle function), the datepicker I linked to, and will add d3.js soon enough. Right now, I think optimization can come later. I just need to get this thing working. I don't need to spend so much time pre-optimizing when the page isn't crushingly slow on anything.

i guess you missed the 2nd one i linked to?
 

Obsoleet

Platinum Member
Oct 2, 2007
2,181
1
0
I've always used someone elses for this. Unless it's a learning exercise, you're asking 'do I reinvent the wheel' here for no appreciable gains.
 

purbeast0

No Lifer
Sep 13, 2001
53,543
6,368
126
It's not really any more bootstrap-ish. It's outdated and just a fork of the one I linked to.

i meant more bootstrap'ish than the first one i linked to.

and it doesn't use any other libraries, just bootstrap.

also a newer version (as pointed out).
 

brianmanahan

Lifer
Sep 2, 2006
24,591
5,994
136
i have never written my own date picker, that would just be dumb

unless you REALLY REALLY want to write a date picker