DayJS Replacement

This commit is contained in:
Patrick Fic
2024-04-18 09:55:18 -07:00
parent 79a0881f5a
commit 7d7fe9819f
13 changed files with 131 additions and 55 deletions

View File

@@ -4,7 +4,8 @@ import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectDates } from "../../../redux/reporting/reporting.selectors";
import moment from "moment";
import dayjs from '../../../util/day.js';
import { DateFormat } from "../../../util/constants";
const mapStateToProps = createStructuredSelector({
dates: selectDates,
@@ -13,9 +14,9 @@ const mapStateToProps = createStructuredSelector({
export function ReportingTitleAtom({ dates }) {
return (
<Typography.Title level={2}>
{`RPS Report for Period from ${moment(dates.startDate).format(
{`RPS Report for Period from ${dayjs(dates.startDate).format(
DateFormat
)} to ${moment(dates.endDate).format(DateFormat)}`}
)} to ${dayjs(dates.endDate).format(DateFormat)}`}
</Typography.Title>
);
}

View File

@@ -1,10 +1,11 @@
import { Tooltip } from "antd";
import moment from "moment";
import dayjs from '../../../util/day.js';
import React, { useEffect, useState } from "react";
export default function TimeAgoFormatter(props) {
const [timestampString, setTimestampString] = useState("");
const m = moment(props.children);
const m = dayjs(props.children);
useEffect(() => {
const timer = setInterval(() => setTimestampString(m.fromNow()), 15000);
setTimestampString(m.fromNow());