Library for rendering calendars in templates?

Hi everyone,

Are there libraries available to render a calendar in a Phoenix template? I’m looking for something that I can pass a number of models to and have it render a calendar template with those models based on some start_date and end_date attributes. Something like day view, week view, and month view would be nice.

I looked around, but I only found calendar and date/time related libraries. So, before I reinvent the wheel, does anyone know of something available? Of course, I can do this with a frontend lib, but I’m not sure it’s worth the hasel.

I’ve ended up writing my own helpers, start/end dates as drop-downs, importing javascript versions, etc… (using webcomponents now), but no real pre-built one yet that I’ve seen, that mostly seems to be based on what web front-end you use, which phoenix uses bootstrap by default, which does not have a date handler like that. :slight_smile:

1 Like

This is very much a front-end problem.

What makes the problem of showing input fields for dates and times difficult is that there exist so many different standards for entering this information. For instance, in the EU we commonly write dd/mm/yyyy, while in america, mm/dd/yyyy is used. The international ISO8601 standard is yyyy-mm-dd which 'should resolve this. But of course, when introducing new standards…

HTML5 introduces new Date and Time input fields that make selecting dates and times more natural; for instance, on a phone it will pop up a native date/time select.(unfortunately not supported by all browser yet). There exist many JavaScript libraries that provide ‘date pickers’ or ‘period pickers’ in varying degrees of functionality and maturity.

You are definitely not the only developer looking for something like this. But as this is a very application-specific problem, and in any case is not something that is part of Phoenix’ back-end, there indeed do not exist any packages providing such features.

@OvermindDL1 @Qqwy I think I might not have explained myself well. I’m not looking for a date picker. I’m looking to render a calendar on the page and display events on it (as per the example link I gave). The two are similar, but not exactly the same. Although, I do agree with you: This is definitely a frontend issue. But I don’t see a problem with writing a helper that can render a calendar server side, with events, and send it back to the browser as an HTML… just like any other template?

In Rails we had several solutions. I assumed someone might have had the need and wrote something to avoid using frontend/js frameworks. But it’s unlikely given how young our ecosystem is. Thanks for chipping in, and for the helpful explanations–I appreciate them.

Hi there! I’m looking for the exact same thing – calendar template. Just wanted to ask how you did it or if you were able to find a library.


Eh, I’m just rendering it into a table as of recent, pretty basic but it works… ^.^;