New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@date-io/moment

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@date-io/moment - npm Package Compare versions

Comparing version 2.17.0 to 3.0.0

1

build/index.d.ts

@@ -1,2 +0,1 @@

import "../type/index";
export { default } from "./moment-utils";

22

build/index.esm.js

@@ -33,3 +33,3 @@ import defaultMoment from 'moment';

class MomentUtils {
constructor({ locale, formats, instance } = {}) {
constructor({ locale, formats, instance, } = {}) {
this.lib = "moment";

@@ -72,12 +72,2 @@ this.is12HourCycleInCurrentLocale = () => {

};
this.date = (value) => {
if (value === null) {
return null;
}
const moment = this.moment(value);
if (this.locale) {
moment.locale(this.locale);
}
return moment;
};
this.toJsDate = (value) => {

@@ -314,4 +304,14 @@ return value.toDate();

}
date(value) {
if (value === null) {
return null;
}
const moment = this.moment(value);
if (this.locale) {
moment.locale(this.locale);
}
return moment;
}
}
export { MomentUtils as default };

@@ -39,3 +39,3 @@ 'use strict';

class MomentUtils {
constructor({ locale, formats, instance } = {}) {
constructor({ locale, formats, instance, } = {}) {
this.lib = "moment";

@@ -78,12 +78,2 @@ this.is12HourCycleInCurrentLocale = () => {

};
this.date = (value) => {
if (value === null) {
return null;
}
const moment = this.moment(value);
if (this.locale) {
moment.locale(this.locale);
}
return moment;
};
this.toJsDate = (value) => {

@@ -320,4 +310,14 @@ return value.toDate();

}
date(value) {
if (value === null) {
return null;
}
const moment = this.moment(value);
if (this.locale) {
moment.locale(this.locale);
}
return moment;
}
}
module.exports = MomentUtils;
import defaultMoment from "moment";
import { IUtils, DateIOFormats, Unit } from "@date-io/core/IUtils";
interface Opts {
locale?: string;
instance?: typeof defaultMoment;
formats?: Partial<DateIOFormats>;
}
type Moment = defaultMoment.Moment;
export default class MomentUtils implements IUtils<defaultMoment.Moment> {
export default class MomentUtils implements IUtils<defaultMoment.Moment, string> {
moment: typeof defaultMoment;

@@ -14,3 +9,7 @@ lib: string;

formats: DateIOFormats;
constructor({ locale, formats, instance }?: Opts);
constructor({ locale, formats, instance, }?: {
formats?: Partial<DateIOFormats>;
locale?: string;
instance?: any;
});
is12HourCycleInCurrentLocale: () => boolean;

@@ -22,3 +21,3 @@ getFormatHelperText: (format: string) => string;

parse: (value: string, format: string) => defaultMoment.Moment | null;
date: (value?: any) => defaultMoment.Moment | null;
date<TArg extends unknown = undefined, TRes extends unknown = TArg extends null ? null : TArg extends undefined ? defaultMoment.Moment : defaultMoment.Moment | null>(value?: TArg): TRes;
toJsDate: (value: Moment) => Date;

@@ -25,0 +24,0 @@ isValid: (value: any) => boolean;

{
"name": "@date-io/moment",
"version": "2.17.0",
"version": "3.0.0",
"description": "Abstraction over common javascript date management libraries",

@@ -17,3 +17,3 @@ "main": "build/index.js",

"dependencies": {
"@date-io/core": "^2.17.0"
"@date-io/core": "^3.0.0"
},

@@ -49,3 +49,3 @@ "devDependencies": {

"license": "MIT",
"gitHead": "e497a04c456f04211c8b0877d002c85e72ea98a2"
"gitHead": "9d304288545a0a9c9f4e3b8aefd428da3757d330"
}

@@ -1,2 +0,1 @@

import "../type/index";
export { default } from "./moment-utils";
import defaultMoment, { LongDateFormatKey } from "moment";
import { IUtils, DateIOFormats, Unit } from "@date-io/core/IUtils";
interface Opts {
locale?: string;
instance?: typeof defaultMoment;
formats?: Partial<DateIOFormats>;
}
type Moment = defaultMoment.Moment;

@@ -41,3 +35,3 @@ const defaultFormats: DateIOFormats = {

export default class MomentUtils implements IUtils<defaultMoment.Moment> {
export default class MomentUtils implements IUtils<defaultMoment.Moment, string> {
public moment: typeof defaultMoment;

@@ -48,3 +42,11 @@ public lib = "moment";

constructor({ locale, formats, instance }: Opts = {}) {
constructor({
locale,
formats,
instance,
}: {
formats?: Partial<DateIOFormats>;
locale?: string;
instance?: any;
} = {}) {
this.moment = instance || defaultMoment;

@@ -109,5 +111,12 @@ this.locale = locale;

public date = (value?: any) => {
date<
TArg extends unknown = undefined,
TRes extends unknown = TArg extends null
? null
: TArg extends undefined
? defaultMoment.Moment
: defaultMoment.Moment | null
>(value?: TArg): TRes {
if (value === null) {
return null;
return null as TRes;
}

@@ -120,4 +129,4 @@

return moment;
};
return moment as TRes;
}

@@ -124,0 +133,0 @@ public toJsDate = (value: Moment) => {

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