From cff1671f6fc51e8abe9062b7288d321df66625fa Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 2 May 2022 17:10:07 -0600 Subject: [PATCH] Et2Date: Handle formatting full month d-M-Y Maybe we just pass all formatting off to flatpickr? --- api/js/etemplate/Et2Date/Et2Date.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/js/etemplate/Et2Date/Et2Date.ts b/api/js/etemplate/Et2Date/Et2Date.ts index f4f6eb5b76..9f5b7a306b 100644 --- a/api/js/etemplate/Et2Date/Et2Date.ts +++ b/api/js/etemplate/Et2Date/Et2Date.ts @@ -17,6 +17,7 @@ import {dateStyles} from "./DateStyles"; import {LitFlatpickr} from "lit-flatpickr"; import "flatpickr/dist/plugins/scrollPlugin.js"; import {holidays} from "./Holidays"; +import flatpickr from "flatpickr"; // Request this year's holidays now holidays(new Date().getFullYear()); @@ -239,6 +240,11 @@ export function formatDate(date : Date, options = {dateFormat: ""}) : string m: (date.getUTCMonth() < 9 ? "0" : "") + (date.getUTCMonth() + 1), Y: "" + date.getUTCFullYear() } + if(dateformat.indexOf("M") != -1) + { + replace_map["M"] = flatpickr.formatDate(date, "M"); + } + let re = new RegExp(Object.keys(replace_map).join("|"), "g"); _value = dateformat.replace(re, function(matched) {