// add date and time

import { CreateDocx, OptionsDateTime, OptionsParagraph } from "../../../build";
import * as fs from "fs";

const docx = new CreateDocx();

// default date and time format
docx.addDateTime();

docx.addText("Date and time with custom format and styles:");

// custom date and time formats and styles
const dateTimeA: OptionsDateTime = {
    format: "M/d/yyyy",
    bold: true,
    color: "333333",
    fontSize: 24,
};
docx.addDateTime(dateTimeA);

const dateTimeB: OptionsDateTime = {
    format: "dd' of 'MMMM' of 'yyyy' at 'H:mm",
    color: "FF0000",
    italic: true,
};
const optionsParagraph: OptionsParagraph = {
    align: "center",
    bold: true,
};
docx.addDateTime(dateTimeB, optionsParagraph);

docx.save().then(contents => {
    fs.writeFileSync("addDateTime_1.docx", Buffer.from(contents));
});
