Day.JS a Great Candidate for Time/Data/Calendar in TiddlyWiki

Plugin requested.

Repo: https://github.com/iamkun/dayjs
Doc: https://day.js.org/

Day.js is a fast 2kB alternative to Moment.js with the same modern API. So it is a good candidate to be wrapped in a plugin (as macro or widget or even filter operator) to allow perform simple date/time calculation and calendar in TiddlyWiki. Day.js has also great support for internationalization.

So it would be amazing if someone can take responsibility and develop the plugin. I expect a plugin with maximum 20kB in size.

1 Like

I note for Timezones, essential I believe This requires the Timezone plugin to work

Great Idea… :+1: :+1: :+1:

Base functions are 2kB if gzipped and 7kB if minified. … I did create a TW development structure at 3rd of May, but did not have time to iron out which functions to expose.

dayjs uses a plugin mechanism to implement functions needed for specific usecases. So the size will be significantly bigger if every possible plugin is added.

Especially internationalisation with all available languages will make it huge. TW has it’s own language switching, so it would be nice if it could be reused, instead of adding a lot of duplicated strings.

I did read the documentation once, but probably forgot most of it already :confused:

  • Base size minified is 7kB
  • All plugins minified are ~ 34kB
  • All 145 locales are 200kB
    • I personally would limit the first version to the existing UI translations we do have already

So the initial library size may be more like 50-60kByte minified. Plus TW wrappers, we may end up close to 100kByte for the plugin. Imo that’s still small enough for a plugin I personally would use.

The function I wanted to start with is the calendar-plugin + all dependencies it needs. So we could have a TW calendar widget, that is consistent with different browsers. The native browser calendars are not flexible enough for styling and look different in every browser.

I do like the calendar, that was developed for projectify. Some code may be borrowed from there.

Then there should be some abstract date-calculations like

  • Tomorrow
  • In x Day(s) / Week(s) / Month(s) / Year(s)
  • The second Tuesday every month/quarter/year (if it’s easy to implement)
  • Days till <date>
  • Add / subtract Dates

just some thoughts
-m

1 Like

me as an international acting person time zones are a mandatory item for a calendar app.

Many thanks in advance.

best Regards, Bapak Ireng

Hi Mario,
Very nice. I did not know you have already started implementing day.js as a plugin! Thank you
Yes, only the most useful function shall be imported to keep it simple and small.

Best wishes

Mohammad

I’m already using Pikaday Plugin: A Repack of Date Picker from Projectify in some of my plugins, which uses momentjs plugin as dependency.

It does not depend on Moment.JS! I assume it uses browser calendar!

1 Like