Repository navigation
JavaScript
Jan Hermann edited this page Oct 19, 2026
·
1 revision
🟨
JavaScript ES module classes exported under a single Timely namespace.
All classes are re-exported from index.js, so they can be imported as one namespace object:
import * as Timely from "./src/timely/index.js";
Timely.Helper.isLeap(2000); // true
Timely.Calculator.sundayOudin(2014); // Date of Easter SundayNamed imports work as well:
import {Helper, Calculator} from "./src/timely/index.js";When the package is installed from npm, the entry point is defined by exports in package.json:
import * as Timely from "@hermajan/timely";| Class | File | Static methods |
|---|---|---|
YearHelper |
years/Helper.js |
isLeap(year), isLeap2(year)
|
DateFormatter |
dates/DateUtil.js |
dayOfWeek(lang, date), formatDate(date)
|
Week |
dates/Week.js |
cs, en (names of the days of the week) |
EasterCalculator |
easter/Calculator.js |
sundayOudin(year), friday(year), monday(year)
|
CzechNameDayFinder |
namedays/czech/CzechFinder.js |
nameDay(day, month), todayName(), getName(date)
|
SlovakNameDayFinder |
namedays/slovak/SlovakFinder.js |
the same as CzechNameDayFinder
|
The clocks in clocks/ are still plain scripts and are not part of the namespace.
Use a module script. Module scripts are deferred, so do not use document.write(); fill elements instead:
<span id="today"></span>
<script type="module">
import * as Timely from "./src/timely/index.js";
document.getElementById("today").textContent = Timely.DateUtil.dmy();
</script>Working demos are in the Examples.
Browsers do not load modules from file://, so serve the project through a local web server (e.g. npx serve or python -m http.server).