mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Show a report for total users chart
This commit is contained in:
parent
794938db72
commit
4d064adf1b
5397 changed files with 313100 additions and 365 deletions
64
node_modules/date-fns/_lib/format/longFormatters.js
generated
vendored
Normal file
64
node_modules/date-fns/_lib/format/longFormatters.js
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
const dateLongFormatter = (pattern, formatLong) => {
|
||||
switch (pattern) {
|
||||
case "P":
|
||||
return formatLong.date({ width: "short" });
|
||||
case "PP":
|
||||
return formatLong.date({ width: "medium" });
|
||||
case "PPP":
|
||||
return formatLong.date({ width: "long" });
|
||||
case "PPPP":
|
||||
default:
|
||||
return formatLong.date({ width: "full" });
|
||||
}
|
||||
};
|
||||
|
||||
const timeLongFormatter = (pattern, formatLong) => {
|
||||
switch (pattern) {
|
||||
case "p":
|
||||
return formatLong.time({ width: "short" });
|
||||
case "pp":
|
||||
return formatLong.time({ width: "medium" });
|
||||
case "ppp":
|
||||
return formatLong.time({ width: "long" });
|
||||
case "pppp":
|
||||
default:
|
||||
return formatLong.time({ width: "full" });
|
||||
}
|
||||
};
|
||||
|
||||
const dateTimeLongFormatter = (pattern, formatLong) => {
|
||||
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
||||
const datePattern = matchResult[1];
|
||||
const timePattern = matchResult[2];
|
||||
|
||||
if (!timePattern) {
|
||||
return dateLongFormatter(pattern, formatLong);
|
||||
}
|
||||
|
||||
let dateTimeFormat;
|
||||
|
||||
switch (datePattern) {
|
||||
case "P":
|
||||
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
||||
break;
|
||||
case "PP":
|
||||
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
||||
break;
|
||||
case "PPP":
|
||||
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
||||
break;
|
||||
case "PPPP":
|
||||
default:
|
||||
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
||||
break;
|
||||
}
|
||||
|
||||
return dateTimeFormat
|
||||
.replace("{{date}}", dateLongFormatter(datePattern, formatLong))
|
||||
.replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
||||
};
|
||||
|
||||
export const longFormatters = {
|
||||
p: timeLongFormatter,
|
||||
P: dateTimeLongFormatter,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue