Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
semkedaniil committed Jun 14, 2024
1 parent aabb2d1 commit 276714f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cassandra-distributed-task-queue-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"react-router-dom": ">=6"
},
"dependencies": {
"@skbkontur/edi-ui": "^0.2.2",
"@skbkontur/edi-ui": "^0.2.3",
"@skbkontur/react-stack-layout": "^1.0.3",
"copy-to-clipboard": "^3.3.1",
"date-fns": "^2.29.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatDate, fromLocalToUtc } from "@skbkontur/edi-ui";
import { DateUtils } from "@skbkontur/edi-ui";
import { endOfDay, isValid, parse as parseDateInternal, startOfDay } from "date-fns";
import difference from "lodash/difference";

Expand Down Expand Up @@ -129,11 +129,11 @@ export class DateTimeRangeMapper {
return null;
}
const parsedValue = parseDateInternal(parameterValue, "yyyy-MM-dd", new Date());
return isValid(parsedValue) ? fromLocalToUtc(parsedValue) : null;
return isValid(parsedValue) ? DateUtils.fromLocalToUtc(parsedValue) : null;
}

public stringifyDate(value: Nullable<Date>): Nullable<string> {
return value ? formatDate(value, "yyyy-MM-dd") : undefined;
return value ? DateUtils.formatDate(value, "yyyy-MM-dd") : undefined;
}

public parse(parsedQueryString: QueryObject): Nullable<DateTimeRange> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StringUtils, TimeUtils, TimeZone, Time, formatDate, RussianDateFormat } from "@skbkontur/edi-ui";
import { StringUtils, TimeUtils, TimeZone, Time, DateUtils, RussianDateFormat } from "@skbkontur/edi-ui";
import { DatePicker as DefaultDatePicker } from "@skbkontur/react-ui";
import React from "react";

Expand Down Expand Up @@ -83,15 +83,15 @@ export class DatePicker extends React.Component<DatePickerProps, DatePickerState

private readonly convertStringToDate = (newStringifiedDate: RussianDateFormat): Date => {
const { timeZone } = this.props;
const date = formatDate(newStringifiedDate, "dd.MM.yyyy");
const ISODate = formatDate(date, "yyyy-MM-dd");
const date = DateUtils.formatDate(newStringifiedDate, "dd.MM.yyyy");
const ISODate = DateUtils.formatDate(date, "yyyy-MM-dd");
const time = this.props.defaultTime || defaultTime;
const timeZoneOffset = TimeUtils.getTimeZoneOffsetOrDefault(timeZone);
return new Date(`${ISODate}T${time}${TimeUtils.timeZoneOffsetToString(timeZoneOffset)}`);
};

private readonly convertDateToStringWithTimezone = (date: Nullable<Date | string>, timeZone?: number) => {
const timeZoneOffset = TimeUtils.getTimeZoneOffsetOrDefault(timeZone);
return date ? formatDate(date, "dd.MM.yyyy", timeZoneOffset) : "";
return date ? DateUtils.formatDate(date, "dd.MM.yyyy", timeZoneOffset) : "";
};
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TimeUtils, toTimeZone, TimeZone } from "@skbkontur/edi-ui";
import { TimeUtils, DateUtils, TimeZone } from "@skbkontur/edi-ui";
import { endOfDay, startOfDay, subDays, subMonths, subYears } from "date-fns";

import { DateTimeRange } from "../../Domain/DataTypes/DateTimeRange";

function utc(): Date {
return toTimeZone(new Date(), TimeUtils.TimeZones.UTC);
return DateUtils.toTimeZone(new Date(), TimeUtils.TimeZones.UTC);
}

export class RangeSelector {
Expand All @@ -18,8 +18,8 @@ export class RangeSelector {
const lower = startOfDay(start);
const upper = endOfDay(end);
return {
lowerBound: toTimeZone(lower, this.timeZone),
upperBound: toTimeZone(upper, this.timeZone),
lowerBound: DateUtils.toTimeZone(lower, this.timeZone),
upperBound: DateUtils.toTimeZone(upper, this.timeZone),
};
}

Expand All @@ -40,7 +40,7 @@ export class RangeSelector {
}

public getMonthOf(date: Date | string): DateTimeRange {
return this.setBounds(subMonths(toTimeZone(date, TimeUtils.TimeZones.UTC), 1), utc());
return this.setBounds(subMonths(DateUtils.toTimeZone(date, TimeUtils.TimeZones.UTC), 1), utc());
}

public getYear(): DateTimeRange {
Expand Down
10 changes: 5 additions & 5 deletions cassandra-distributed-task-queue-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2923,7 +2923,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@skbkontur/cassandra-distributed-task-queue-ui@workspace:."
dependencies:
"@skbkontur/edi-ui": "npm:^0.2.2"
"@skbkontur/edi-ui": "npm:^0.2.3"
"@skbkontur/icons": "npm:^1.3.0"
"@skbkontur/react-stack-layout": "npm:^1.0.3"
"@skbkontur/react-ui": "npm:^4.22.0"
Expand Down Expand Up @@ -2981,9 +2981,9 @@ __metadata:
languageName: node
linkType: hard

"@skbkontur/edi-ui@npm:^0.2.2":
version: 0.2.2
resolution: "@skbkontur/edi-ui@npm:0.2.2"
"@skbkontur/edi-ui@npm:^0.2.3":
version: 0.2.3
resolution: "@skbkontur/edi-ui@npm:0.2.3"
dependencies:
"@skbkontur/colors": "npm:0.4.4"
"@skbkontur/icons": "npm:1.10.0"
Expand All @@ -2997,7 +2997,7 @@ __metadata:
"@skbkontur/react-ui": ">=4"
react: ">=16 <=18"
react-dom: ">=16 <=18"
checksum: fdeb778443a969cf8f66ea600d46d664bc2d2543dd9763361579067087ff3d41ff15e15cd2d0da24cf063313ca84fe9d058bbb523601bcb92cde81a1d99a155a
checksum: 98b20235ecd51367140c419929aafffaaac526f1d4dcc47890a0849243d1398dc00215331eca8d84d7d1f86117f7580d964650c6624c1731f6424ed7669ab780
languageName: node
linkType: hard

Expand Down

0 comments on commit 276714f

Please sign in to comment.