Skip to content

buildCollection

buildCollection(events, options?): SerializedCollection

Assemble a portable SerializedCollection from plain configs — the stateless half of CalendaryInstance.toCollection: no engine instance, no expansion, just configs → document. Pass plugins (the same instances you would use()) to derive the manifest, and schema to stamp $schema so you don’t graft it yourself.

EventConfig[]

string

CalendaryPlugin[]

string

string

SerializedCollection

const cdy = buildCollection(configs, {
name: "family",
plugins: [lunar(), liturgical()],
schema: "https://calendaryjs.dev/schema/cdy.json",
});
// → { $schema, collection: "family", plugins: [...], events: configs }