Socket
Socket
Sign inDemoInstall

@internationalized/date

Package Overview
Dependencies
Maintainers
2
Versions
558
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internationalized/date - npm Package Compare versions

Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2

2

dist/types.d.ts

@@ -114,2 +114,4 @@ export interface AnyCalendarDate {

export function maxDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B;
export function isWeekend(date: DateValue, locale: string): boolean;
export function isWeekday(date: DateValue, locale: string): boolean;
type Mutable<T> = {

@@ -116,0 +118,0 @@ -readonly [P in keyof T]: T[P];

4

package.json
{
"name": "@internationalized/date",
"version": "3.0.0-alpha.1",
"version": "3.0.0-alpha.2",
"description": "Internationalized calendar and date manipulation utilities",

@@ -25,3 +25,3 @@ "license": "Apache-2.0",

},
"gitHead": "16fc29ac722793ffaea083f13760d82ab341cc8d"
"gitHead": "54c2366c4f31bd4bf619126131cd583c12972acc"
}

@@ -218,1 +218,42 @@ /*

}
const WEEKEND_DATA = {
AF: [4, 5],
AE: [5, 6],
BH: [5, 6],
DZ: [5, 6],
EG: [5, 6],
IL: [5, 6],
IQ: [5, 6],
IR: [5, 5],
JO: [5, 6],
KW: [5, 6],
LY: [5, 6],
OM: [5, 6],
QA: [5, 6],
SA: [5, 6],
SD: [5, 6],
SY: [5, 6],
YE: [5, 6]
};
export function isWeekend(date: DateValue, locale: string) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1) % 7;
if (dayOfWeek < 0) {
dayOfWeek += 7;
}
let region = getRegion(locale);
// Use Intl.Locale for this once weekInfo is supported.
// https://github.com/tc39/proposal-intl-locale-info
let [start, end] = WEEKEND_DATA[region] || [6, 0];
return dayOfWeek === start || dayOfWeek === end;
}
export function isWeekday(date: DateValue, locale: string) {
return !isWeekend(date, locale);
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc