mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-08-07 13:05:43 +00:00
971df8edba
- Remove all 3rd party parachain configurations from endpoints: - productionRelayPolkadot.ts: Keep only system parachains - productionRelayDicle.ts: Keep only system parachains - testingRelayZagros.ts: Keep only system parachains - testingRelayTeyrChain.ts: Keep only system parachains - Update domain references: - polkadot.js.org → pezkuwichain.app - wiki.polkadot.network → wiki.pezkuwichain.io - dotapps.io → pezkuwichain.app - statement.polkadot.network → docs.pezkuwichain.io/statement - support.polkadot.network → docs.pezkuwichain.io - Update repository references: - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap - Rename system parachains to Pezkuwi ecosystem: - PolkadotAssetHub → PezkuwiAssetHub - polkadotBridgeHub → pezkuwiBridgeHub - polkadotCollectives → pezkuwiCollectives - polkadotCoretime → pezkuwiCoretime - polkadotPeople → pezkuwiPeople - Update network name in claims utility: - Polkadot → Pezkuwi
65 lines
1.5 KiB
TypeScript
65 lines
1.5 KiB
TypeScript
// Copyright 2017-2026 @pezkuwi/app-calendar authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { DateState } from './types.js';
|
|
|
|
import { DAYS } from './constants.js';
|
|
|
|
export function newZeroDate (input: Date): Date {
|
|
const date = new Date(input);
|
|
|
|
date.setHours(0);
|
|
date.setMinutes(0);
|
|
date.setSeconds(0);
|
|
date.setMilliseconds(0);
|
|
|
|
return date;
|
|
}
|
|
|
|
export function nextMonth (date: Date, firstDay = 1): Date {
|
|
const currMonth = date.getMonth();
|
|
|
|
return currMonth === 11
|
|
? new Date(date.getFullYear() + 1, 0, firstDay)
|
|
: new Date(date.getFullYear(), currMonth + 1, firstDay);
|
|
}
|
|
|
|
export function prevMonth (date: Date): Date {
|
|
const currMonth = date.getMonth();
|
|
|
|
return currMonth === 0
|
|
? new Date(date.getFullYear() - 1, 11, 1)
|
|
: new Date(date.getFullYear(), currMonth - 1, 1);
|
|
}
|
|
|
|
export function getDateState (_dateMonth: Date, _dateSelected: Date): DateState {
|
|
const dateMonth = newZeroDate(_dateMonth);
|
|
|
|
dateMonth.setDate(1);
|
|
|
|
const dateMonthNext = nextMonth(dateMonth);
|
|
const dateSelected = newZeroDate(_dateSelected);
|
|
const numDays = nextMonth(dateMonth, 0).getDate();
|
|
const days: number[] = [];
|
|
|
|
for (let i = 1; i <= numDays; i++) {
|
|
days.push(i);
|
|
}
|
|
|
|
return {
|
|
dateMonth,
|
|
dateMonthNext,
|
|
dateSelected,
|
|
days,
|
|
startClass: `start${DAYS[dateMonth.getDay()]}`
|
|
};
|
|
}
|
|
|
|
export function dateCalendarFormat (date: Date): string {
|
|
return new Date(date)
|
|
.toISOString()
|
|
.split('.')[0]
|
|
.replace(/-/g, '')
|
|
.replace(/:/g, '') + 'Z';
|
|
}
|