Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to dateformat 5.0.3 #7317

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/Models/Catalog/Ows/WebMapServiceCapabilitiesStratum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ import WebMapServiceCapabilities, {
getRectangleFromLayer
} from "./WebMapServiceCapabilities";
import WebMapServiceCatalogItem from "./WebMapServiceCatalogItem";

const dateFormat = require("dateformat");
import dateFormat from "dateformat";

/** Transforms WMS GetCapabilities XML into WebMapServiceCatalogItemTraits */
export default class WebMapServiceCapabilitiesStratum extends LoadableStratum(
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/BottomDock/Timeline/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { scrollBars } from "../../../Styled/mixins";
import Spacing from "../../../Styled/Spacing";
import Icon from "../../../Styled/Icon";
import { formatDateTime } from "./DateFormats";
import dateFormat from "dateformat";

const dateFormat = require("dateformat");
const DatePicker = require("react-datepicker").default;

function daysInMonth(month: number, year: number) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/Tools/DiffTool/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Text, { TextSpan } from "../../../Styled/Text";
import Box from "../../../Styled/Box";
import Button from "../../../Styled/Button";
import Spacing from "../../../Styled/Spacing";
const dateFormat = require("dateformat");
import dateFormat from "dateformat";

interface PropsType extends WithTranslation {
heading: string;
Expand Down
19 changes: 13 additions & 6 deletions lib/ReactViews/Tools/DiffTool/DiffTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ import DatePicker from "./DatePicker";
import LocationPicker from "./LocationPicker";
import { CLOSE_TOOL_ID } from "../../Map/MapNavigation/registerMapNavigations";
import updateModelFromJson from "../../../Models/Definition/updateModelFromJson";

const dateFormat = require("dateformat");
import dateFormat from "dateformat";

type DiffableItem = DiffableMixin.Instance;

Expand Down Expand Up @@ -250,8 +249,8 @@ class Main extends React.Component<MainPropsType> {
if (!firstDate || !secondDate) {
return name;
} else {
const d1 = dateFormat(firstDate, format);
const d2 = dateFormat(secondDate, format);
const d1 = dateFormat(JulianDate.toDate(firstDate), format);
const d2 = dateFormat(JulianDate.toDate(secondDate), format);
return `${name} - difference for dates ${d1}, ${d2}`;
}
}
Expand Down Expand Up @@ -567,7 +566,11 @@ class Main extends React.Component<MainPropsType> {
<Box column alignItemsFlexStart>
{this.leftDate && (
<Text large>
(A) {dateFormat(this.leftDate, "dd/mm/yyyy")}
(A){" "}
{dateFormat(
JulianDate.toDate(this.leftDate),
"dd/mm/yyyy"
)}
</Text>
)}
{!this.leftDate && (
Expand All @@ -580,7 +583,11 @@ class Main extends React.Component<MainPropsType> {
<Spacing bottom={1} />
{this.rightDate && (
<Text large>
(B) {dateFormat(this.rightDate, "dd/mm/yyyy")}
(B){" "}
{dateFormat(
JulianDate.toDate(this.rightDate),
"dd/mm/yyyy"
)}
</Text>
)}
{!this.rightDate && (
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@types/d3-scale-chromatic": "^3.0.3",
"@types/d3-selection": "^3.0.10",
"@types/d3-transition": "^3.0.8",
"@types/dateformat": "^3.0.1",
"@types/dateformat": "^5.0.1",
"@types/dompurify": "^2.3.1",
"@types/file-saver": "^1.3.0",
"@types/flexsearch": "^0.7.1",
Expand Down Expand Up @@ -109,7 +109,7 @@
"d3-shape": "^3.2.0",
"d3-transition": "^3.0.1",
"d3-zoom": "^3.0.0",
"dateformat": "^3.0.3",
"dateformat": "^5.0.3",
"dompurify": "^2.3.3",
"fetch-mock": "^9.11.0",
"file-loader": "^3.0.1",
Expand Down Expand Up @@ -193,7 +193,6 @@
"devDependencies": {
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@types/dateformat": "^3.0.1",
"@types/node": "^18.15.11",
"@types/webpack": "4.41.33",
"@typescript-eslint/eslint-plugin": "^6.12.0",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1863,10 +1863,10 @@
dependencies:
"@types/d3-selection" "*"

"@types/dateformat@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-3.0.1.tgz#98d747a2e5e9a56070c6bf14e27bff56204e34cc"
integrity sha512-KlPPdikagvL6ELjWsljbyDIPzNCeliYkqRpI+zea99vBBbCIA5JNshZAwQKTON139c87y9qvTFVgkFd14rtS4g==
"@types/dateformat@^5.0.1":
version "5.0.2"
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-5.0.2.tgz#876f06431ce6f411dbaca3f81d95a8784c9ab82a"
integrity sha512-M95hNBMa/hnwErH+a+VOD/sYgTmo15OTYTM2Hr52/e0OdOuY+Crag+kd3/ioZrhg0WGbl9Sm3hR7UU+MH6rfOw==

"@types/dompurify@^2.3.1":
version "2.3.3"
Expand Down Expand Up @@ -4795,10 +4795,10 @@ date-format@^4.0.14:
resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.14.tgz#7a8e584434fb169a521c8b7aa481f355810d9400"
integrity sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==

dateformat@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
dateformat@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-5.0.3.tgz#fe2223eff3cc70ce716931cb3038b59a9280696e"
integrity sha512-Kvr6HmPXUMerlLcLF+Pwq3K7apHpYmGDVqrxcDasBg86UcKeTSNWbEzU8bwdXnxnR44FtMhJAxI4Bov6Y/KUfA==

debounce@^1.2.1:
version "1.2.1"
Expand Down