Discourse-chronos 🌐 ⏲

deprecated

(Joffrey Jaffeux) #1

:warning: This plugin is deprecated, local-dates is now in core and replaces the plugin! :warning:

The discourse chronos plugin allows you to create dated events which will be shown to every users in their timezone. The plugin will also allow you to create recurring events, which will automatically correctly show the date of the next event.

Installation

Add the following line to your container, in the plugin install section

  - cd /var/www/discourse/plugins && sudo -E -u discourse git clone https://github.com/discourse/discourse-chronos

Site Settings

In a multi site environment each site can enable or disable the extension with the enable_discourse_chronos setting.

discourse_chronos_default_formats lets you define formats shortcuts to be used in the form when you create an event

discourse_chronos_default_timezones lets you define the timezones used by default when you create an event, you can customise this for each event.

Screenshots


Events Plugin :calendar:
Feature idea: auto-bump a topic if its title contains today's date
Localised inline date/time
Events Plugin :calendar:
Events Plugin :calendar:
(Joffrey Jaffeux) #27

Discourse Chronos is now released, please let your comments in this topic (it’s not deployed on meta).


(Joffrey Jaffeux) #28

Chronos is deployed on meta since April 5, 2018 17:30 (Europe: Paris), April 5, 2018 08:30 (America: Los Angeles)


Discourse 2.0.0.beta8 Release Notes
Discourse 2.0.0.beta6 Release Notes
(Michael Downey) #29

Congrats! A few questions/comments:

  1. Is there an easy way to explain the difference between this plugin and Events Plugin that some of us are already using?

  2. It seems that the output of this plugin is to insert a dynamic date & time with time zone, is that correct?

  3. A small note: When I click the :gear: button in the editor, the cancel link at the bottom of the dialog box does not work. (Confirmed in Firefox as well as Chrome.)

Looking forward to seeing this one in action :slight_smile:


(Joshua Rosenfeld) #30
  1. This plugin is purely intended for sharing a date/time across multiple time zones in a post. It does not organize events on a calendar, does not provide a custom topic view, etc.

  2. Correct. You can see its usage in Joffrey’s post above

  3. I can confirm this as well. The :x: at the top works though cc @joffreyjaffeux.


(Kris) #31

:heart_eyes: This is so useful! Posting this on April 5, 2018 18:08 (Europe: Paris), April 5, 2018 09:08 (America: Los Angeles)

A little feedback:

  1. I don’t think what it does is immediately clear, maybe the window could use a descriptive sentence of what the intention is? Something like:

    Create event
    Add a date & time to your post that everyone will see in their local timezones.

  2. I think “Timezones to display” is a little unclear… If I don’t understand the plugin it makes it seem like these could be the only timezones that display?


    Maybe change the label to:

    Fallback timezones
    These timezones will display in previews and when dynamic timezone data is unavailable.


(Joffrey Jaffeux) #32

Yeah I do agree copy could be better, it’s in discourse repositories, so please don’t hesitate to edit it. As you know I’m not native, and yes sometimes I’m not subtle enough to explain concepts clearly.


(Jeff Atwood) #33

Can we use globe glyph to expand the time zone? To me printing the time zone is extra data that I don’t usually need to see, what I care about is my rendered accurate local time. The globe glyph would let me know it has been translated to my local time zone, and I could click or tap it to see specifics if desired?


(Joshua Rosenfeld) #34

The timezone is optional though. Here is me posting via Chronos without including (\T\Z) in the format. I wrote this post at ,

I’d support removing is as the default format, but removing it all together seems excessive.


(Kris) #35

I think removing the timezone (and possibly even hiding it) would be extra confusing, because there’s no way to indicate that it’s being translated into my time correctly (or at all, if I’m unaware of the functionality).


(Jeff Atwood) #36

That is what the globe glyph is for.


(Joffrey Jaffeux) #37

Ok I will think about it and try to improve this. I like the glyph idea cause it would make a good call to action on mobile too where title attribute doesn’t work.


(Angus McLeod) #38

Sweet! Great work.

Difference with the Events Plugin

Yes, perhaps the key difference is this plugin is post-centric whereas the Events plugin is topic-centric. Post-centric lends itself to management and coordination of remote teams, tasks and information, whereas topic-centric lends itself to in-person or otherwise defined ‘events’.

There is an overlap (i.e. you could do either primary use case with either plugin), but the structure is different enough for the plugins to be complimentary rather than competing. I could see both working on the same forum.

Actually, I’d like to add support for showing chronos datetimes on the discourse-calendar component I’ve built for the Events Plugin, which would add enhance the usability of both plugins. The calendar with both topic and post event details could also be placed in other places aside from the Discovery topic lists.

Minor Notes

  • Time input is slightly larger than date input.

    Screenshot%20at%20Apr%2006%2008-15-17

  • The “All Available Keys” link to the momentjs docs is a little confusing as both implies there are other keys not included in the list and that you could potentially use them (but the list does not permit additions). I reckon the link is not really needed at all. Just list of recurrence options is probably enough.

    Screenshot%20at%20Apr%2006%2008-16-23

Timezones

One of the things I grappled with when integrating timezones in the Events Plugin was whether or not to use the IANA timezones (e.g. “Europe/Paris”) in the UI, or another more recognisable set. Most of the time you see timezones associated with cities or “${Region} Standard Time” (this example is from Google Calendar):

Screenshot%20at%20Apr%2006%2008-25-08

I’m currently using the mapping of IANA timezones to more recognisable names that Rails provides through ActiveSupport::TimeZone, i.e.

@values ||= ActiveSupport::TimeZone::MAPPING.map do |k, v|
  {
    name: ActiveSupport::TimeZone.new(k).to_s,
    value: v
  }
end

So I get a list of more “Readable” timezones that maps to the more useful IANA timezones. This approach was suggested by the useful Timezone tag info on SO.

I think this is generally the way to go, however I’m not entirely happy with the current implementation of this in the Events Plugin. One of the issues being that some Rails labels relate to the same IANA timezone which means that when you put this list into a combo-box, you can’t distinguish between those labels (as the key is the same). Not a huge issue, but it points to the fact that using this approach introduces extra complexity.


(Joffrey Jaffeux) #39

Yes I know for the input height, but dont want to introduce a special case here, don’t have the code at hand, but I think this is a core issue, so will look at this later.

The link implies that you can manually change text directly in the composer, I honnestly don’t see the issue with this, it’s a power user feature, if you don’t get it, just use the dropdown.

I don’t see the interest of the timezones you mentioned, also things like « eastern time » doesn’t mean anything to most european countries as we are not used to have timezones in date like multiple timezone countries.


(Gerhard Schlager) #40

Why does the plugin contain moment.js.min? Does it not work with the version included in Discourse?
I think that file is causing problems with translations. Currently topic timers look like this:

image

Without the plugin everything works fine. Maybe there’s a version conflict or it’s because the plugin doesn’t include locale files.


(Joffrey Jaffeux) #41

Ok I will investigate, it was easier to do so. will see if I can get rid of it or namespace it.


(Joffrey Jaffeux) #42

II have a fix ready, but it required a discourse core fix, awaiting sam review/approval.


(Benjol) #43

I have a translation question.
In js.discourse_chronos.create.form.recurring_description, should the “years, quarters, months, weeks, days, hours, minutes, seconds, milliseconds” be translated, or are these code keywords?

Also, reccurence is spelt recurrence :slight_smile:


(Joffrey Jaffeux) #44

Good question, those are code keywords and should stay in english. Thanks.


(Joffrey Jaffeux) #45

This is now fixed by:

It will allow you to write:

register_asset "moment.js", :vendored_core_pretty_text

This will load discourse core moment.js lib into pretty text bundle, avoiding lib clashing and making sure you whole discourse instance is on the same lib.