[Widget] Calendar improvements for European/non-US locales

Hi everyone,

I’ve been using the Grist calendar widget with French and European data and ran into a few rough edges. After digging into the code I ended up fixing four issues, and I figured I’d share for anyone in a similar situation.

The fixes

  1. Initial date — The widget was jumping to the first selected record’s date on load instead of showing today. Fixed with a one-shot flag that lands on today at startup.

  2. First day of week — Always started on Sunday regardless of locale. Now reads Intl.Locale.getWeekInfo() and respects the Grist culture URL parameter, so French/European users see Monday-first weeks automatically.

  3. 12h/24h time format — Time slots in the day/week view were always in 24h format. Now auto-detects the locale preference via Intl.DateTimeFormat.resolvedOptions().hour12, so en-US users get 2 PM and fr-FR users get 14:00.

  4. Pure Date columns — When Start/End are mapped to Date columns (no time component), the hourly time grid was wasted space. Now it hides automatically and the all-day panel expands to fill the view.

Try it now

All four fixes are live on my fork’s GitHub Pages — just point your custom widget URL to:
https://lmzr.github.io/grist-widget/calendar/index.html

It’s a drop-in replacement for the standard widget.

Note: To get translated labels (day names, months, buttons…), append ?language=fr directly to the widget URL:
https://lmzr.github.io/grist-widget/calendar/index.html?language=fr
Grist currently forces en as the default language regardless of your account or document settings.

For the Grist team :waving_hand:

I’ve submitted PRs for each fix against gristlabs/grist-widget:

Happy to discuss or adjust based on feedback!

8 Likes

Wow you rock thanks a lot :slight_smile:

Wasn’t it fixable as the other issues?

I’m not sure where the issue comes from. I worked only on the calendar widget. It might be a bug or a design decision (possibly temporary) in core or elsewhere. It would be good if the Grist team could look into this. Reported here: Widget iframe parameters language and currency don't reflect document/account settings

1 Like

Thanks. Just tested your PoC today and everything works except First day of week (I’m french, it’s still sunday)