chart formatting + version increasing
This commit is contained in:
parent
fd5f4ed65e
commit
be51811818
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gantt-task-react",
|
||||
"version": "0.3.5",
|
||||
"version": "0.3.6",
|
||||
"description": "Interactive Gantt Chart for React with TypeScript.",
|
||||
"author": "MaTeMaTuK <maksym.vikarii@gmail.com>",
|
||||
"homepage": "https://github.com/MaTeMaTuK/gantt-task-react",
|
||||
|
||||
@ -3,7 +3,10 @@ import styles from "./task-list-table.module.css";
|
||||
import { Task } from "../../types/public-types";
|
||||
|
||||
const localeDateStringCache = {};
|
||||
const toLocaleDateStringFactory = (locale: string) => (date: Date, dateTimeOptions: Intl.DateTimeFormatOptions) => {
|
||||
const toLocaleDateStringFactory = (locale: string) => (
|
||||
date: Date,
|
||||
dateTimeOptions: Intl.DateTimeFormatOptions
|
||||
) => {
|
||||
const key = date.toString();
|
||||
let lds = localeDateStringCache[key];
|
||||
if (!lds) {
|
||||
@ -12,6 +15,12 @@ const toLocaleDateStringFactory = (locale: string) => (date: Date, dateTimeOptio
|
||||
}
|
||||
return lds;
|
||||
};
|
||||
const dateTimeOptions: Intl.DateTimeFormatOptions = {
|
||||
weekday: "short",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
};
|
||||
|
||||
export const TaskListTableDefault: React.FC<{
|
||||
rowHeight: number;
|
||||
@ -32,13 +41,9 @@ export const TaskListTableDefault: React.FC<{
|
||||
locale,
|
||||
onExpanderClick,
|
||||
}) => {
|
||||
const dateTimeOptions: Intl.DateTimeFormatOptions = {
|
||||
weekday: "short",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
};
|
||||
const toLocaleDateString = useMemo(() => toLocaleDateStringFactory(locale), [locale]);
|
||||
const toLocaleDateString = useMemo(() => toLocaleDateStringFactory(locale), [
|
||||
locale,
|
||||
]);
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -108,4 +113,3 @@ export const TaskListTableDefault: React.FC<{
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -12,7 +12,10 @@ type DateHelperScales =
|
||||
| "millisecond";
|
||||
|
||||
const intlDTCache = {};
|
||||
const getCachedDateTimeFormat = (locString: string | string[], opts: DateTimeFormatOptions = {}): DateTimeFormat => {
|
||||
const getCachedDateTimeFormat = (
|
||||
locString: string | string[],
|
||||
opts: DateTimeFormatOptions = {}
|
||||
): DateTimeFormat => {
|
||||
const key = JSON.stringify([locString, opts]);
|
||||
let dtf = intlDTCache[key];
|
||||
if (!dtf) {
|
||||
@ -22,7 +25,6 @@ const getCachedDateTimeFormat = (locString: string | string[], opts: DateTimeFor
|
||||
return dtf;
|
||||
};
|
||||
|
||||
|
||||
export const addToDate = (
|
||||
date: Date,
|
||||
quantity: number,
|
||||
@ -187,4 +189,3 @@ export const getWeekNumberISO8601 = (date: Date) => {
|
||||
export const getDaysInMonth = (month: number, year: number) => {
|
||||
return new Date(year, month + 1, 0).getDate();
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user