mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
Et2Date: Handle formatting full month d-M-Y
Maybe we just pass all formatting off to flatpickr?
This commit is contained in:
parent
ae73511958
commit
cff1671f6f
@ -17,6 +17,7 @@ import {dateStyles} from "./DateStyles";
|
|||||||
import {LitFlatpickr} from "lit-flatpickr";
|
import {LitFlatpickr} from "lit-flatpickr";
|
||||||
import "flatpickr/dist/plugins/scrollPlugin.js";
|
import "flatpickr/dist/plugins/scrollPlugin.js";
|
||||||
import {holidays} from "./Holidays";
|
import {holidays} from "./Holidays";
|
||||||
|
import flatpickr from "flatpickr";
|
||||||
|
|
||||||
// Request this year's holidays now
|
// Request this year's holidays now
|
||||||
holidays(new Date().getFullYear());
|
holidays(new Date().getFullYear());
|
||||||
@ -239,6 +240,11 @@ export function formatDate(date : Date, options = {dateFormat: ""}) : string
|
|||||||
m: (date.getUTCMonth() < 9 ? "0" : "") + (date.getUTCMonth() + 1),
|
m: (date.getUTCMonth() < 9 ? "0" : "") + (date.getUTCMonth() + 1),
|
||||||
Y: "" + date.getUTCFullYear()
|
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");
|
let re = new RegExp(Object.keys(replace_map).join("|"), "g");
|
||||||
_value = dateformat.replace(re, function(matched)
|
_value = dateformat.replace(re, function(matched)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user