Update 0BDFDB.plugin.js

This commit is contained in:
Mirco Wittrien 2021-03-15 13:34:45 +01:00
parent cccd0ac3c7
commit 498593515e
1 changed files with 8 additions and 2 deletions

View File

@ -5644,7 +5644,9 @@ module.exports = (_ => {
"$m will be replaced with the Month",
"$mm will be replaced with the Month (Forced Zeros)",
"$yy will be replaced with the Year (2-Digit)",
"$yyyy will be replaced with the Year (4-Digit)"
"$yyyy will be replaced with the Year (4-Digit)",
"$month will be replaced with the Month Name",
"$monthS will be replaced with the Month Name (Short Form)",
].join("\n"),
onChange: value => {
this.props.dateString = value;
@ -5750,10 +5752,13 @@ module.exports = (_ => {
InternalComponents.LibraryComponents.DateInput.formatDate = function (string, time) {
if (!string || typeof string != "string" || !time) return "";
const timeObj = InternalComponents.LibraryComponents.DateInput.parseDate(time);
const language = BDFDB.LanguageUtils.getLanguage().id;
const day = timeObj.getDate();
const month = timeObj.getMonth()+1;
const year = timeObj.getFullYear();
return string
.replace(/\$monthS/g, timeObj.toLocaleDateString(language, {month: "short"}))
.replace(/\$month/g, timeObj.toLocaleDateString(language, {month: "long"}))
.replace(/\$dd/g, day < 10 ? `0${day}` : day)
.replace(/\$d/g, day)
.replace(/\$mm/g, month < 10 ? `0${month}` : month)
@ -5764,6 +5769,7 @@ module.exports = (_ => {
InternalComponents.LibraryComponents.DateInput.formatTime = function (string, time, hour12) {
if (!string || typeof string != "string" || !time) return "";
const timeObj = InternalComponents.LibraryComponents.DateInput.parseDate(time);
const language = BDFDB.LanguageUtils.getLanguage().id;
let hours = timeObj.getHours();
if (hour12 && hours > 12) hours -= 12;
const minutes = timeObj.getMinutes();
@ -5778,7 +5784,7 @@ module.exports = (_ => {
.replace(/\$s/g, seconds)
.replace(/\$uu/g, milli < 10 ? `00${seconds}` : milli < 100 ? `0${milli}` : milli)
.replace(/\$u/g, milli);
return hour12 ? timeObj.toLocaleTimeString(BDFDB.LanguageUtils.getLanguage().id, {hour12: true}).replace(/\d{1,2}[^\d]\d{1,2}[^\d]\d{1,2}/g, string) : string;
return hour12 ? timeObj.toLocaleTimeString(language, {hour12: true}).replace(/\d{1,2}[^\d]\d{1,2}[^\d]\d{1,2}/g, string) : string;
};
InternalComponents.LibraryComponents.EmojiPickerButton = reactInitialized && class BDFDB_EmojiPickerButton extends LibraryModules.React.Component {