Socket
Socket
Sign inDemoInstall

@date-io/date-fns

Package Overview
Dependencies
2
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

5

build/date-fns-utils.d.ts

@@ -6,2 +6,4 @@ import SampleLocale from "date-fns/locale/en-US";

locale?: Locale;
yearFormat: string;
yearMonthFormat: string;
dateTime12hFormat: string;

@@ -44,5 +46,7 @@ dateTime24hFormat: string;

getMonth(date: Date): number;
setMonth(date: Date, count: number): Date;
getMeridiemText(ampm: "am" | "pm"): "AM" | "PM";
getNextMonth(date: Date): Date;
getPreviousMonth(date: Date): Date;
getMonthArray(date: Date): Date[];
mergeDateAndTime(date: Date, time: Date): Date;

@@ -56,2 +60,3 @@ getWeekdays(): string[];

getDateTimePickerHeaderText(date: Date): string;
getMonthText(date: Date): string;
getDayText(date: Date): string;

@@ -58,0 +63,0 @@ getHourText(date: Date, ampm: boolean): string;

26

build/index.esm.js

@@ -21,2 +21,3 @@ import addDays from 'date-fns/addDays';

import setMinutes from 'date-fns/setMinutes';
import setMonth from 'date-fns/setMonth';
import setSeconds from 'date-fns/setSeconds';

@@ -33,2 +34,4 @@ import setYear from 'date-fns/setYear';

var locale = (_a === void 0 ? {} : _a).locale;
this.yearFormat = "yyyy";
this.yearMonthFormat = "MMMM yyyy";
this.dateTime12hFormat = "MMMM do hh:mm aaaa";

@@ -42,3 +45,3 @@ this.dateTime24hFormat = "MMMM do HH:mm";

// Note: date-fns input types are more lenient than this adapter, so we need to expose our more
// strict signature and delegate to the more lenient sigtature. Otherwise, we have downstream type errors upon usage.
// strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.
DateFnsUtils.prototype.addDays = function (value, count) {

@@ -48,3 +51,3 @@ return addDays(value, count);

DateFnsUtils.prototype.isValid = function (value) {
return isValid(value);
return isValid(this.date(value));
};

@@ -144,2 +147,5 @@ DateFnsUtils.prototype.getDiff = function (value, comparing) {

};
DateFnsUtils.prototype.setMonth = function (date, count) {
return setMonth(date, count);
};
DateFnsUtils.prototype.getMeridiemText = function (ampm) {

@@ -154,2 +160,11 @@ return ampm === "am" ? "AM" : "PM";

};
DateFnsUtils.prototype.getMonthArray = function (date) {
var firstMonth = startOfYear(date);
var monthArray = [firstMonth];
while (monthArray.length < 12) {
var prevMonth = monthArray[monthArray.length - 1];
monthArray.push(this.getNextMonth(prevMonth));
}
return monthArray;
};
DateFnsUtils.prototype.mergeDateAndTime = function (date, time) {

@@ -164,3 +179,3 @@ return this.setMinutes(this.setHours(date, this.getHours(time)), this.getMinutes(time));

end: endOfWeek(now, { locale: this.locale })
}, { locale: this.locale }).map(function (day) { return format(day, "EEEEEE", { locale: _this.locale }); });
}).map(function (day) { return format(day, "EEEEEE", { locale: _this.locale }); });
};

@@ -195,3 +210,3 @@ DateFnsUtils.prototype.getWeekArray = function (date) {

DateFnsUtils.prototype.getCalendarHeaderText = function (date) {
return format(date, "MMMM yyyy", { locale: this.locale });
return format(date, this.yearMonthFormat, { locale: this.locale });
};

@@ -207,2 +222,5 @@ DateFnsUtils.prototype.getYearText = function (date) {

};
DateFnsUtils.prototype.getMonthText = function (date) {
return format(date, "MMMM", { locale: this.locale });
};
DateFnsUtils.prototype.getDayText = function (date) {

@@ -209,0 +227,0 @@ return format(date, "d", { locale: this.locale });

@@ -25,2 +25,3 @@ 'use strict';

var setMinutes = _interopDefault(require('date-fns/setMinutes'));
var setMonth = _interopDefault(require('date-fns/setMonth'));
var setSeconds = _interopDefault(require('date-fns/setSeconds'));

@@ -37,2 +38,4 @@ var setYear = _interopDefault(require('date-fns/setYear'));

var locale = (_a === void 0 ? {} : _a).locale;
this.yearFormat = "yyyy";
this.yearMonthFormat = "MMMM yyyy";
this.dateTime12hFormat = "MMMM do hh:mm aaaa";

@@ -46,3 +49,3 @@ this.dateTime24hFormat = "MMMM do HH:mm";

// Note: date-fns input types are more lenient than this adapter, so we need to expose our more
// strict signature and delegate to the more lenient sigtature. Otherwise, we have downstream type errors upon usage.
// strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.
DateFnsUtils.prototype.addDays = function (value, count) {

@@ -52,3 +55,3 @@ return addDays(value, count);

DateFnsUtils.prototype.isValid = function (value) {
return isValid(value);
return isValid(this.date(value));
};

@@ -148,2 +151,5 @@ DateFnsUtils.prototype.getDiff = function (value, comparing) {

};
DateFnsUtils.prototype.setMonth = function (date, count) {
return setMonth(date, count);
};
DateFnsUtils.prototype.getMeridiemText = function (ampm) {

@@ -158,2 +164,11 @@ return ampm === "am" ? "AM" : "PM";

};
DateFnsUtils.prototype.getMonthArray = function (date) {
var firstMonth = startOfYear(date);
var monthArray = [firstMonth];
while (monthArray.length < 12) {
var prevMonth = monthArray[monthArray.length - 1];
monthArray.push(this.getNextMonth(prevMonth));
}
return monthArray;
};
DateFnsUtils.prototype.mergeDateAndTime = function (date, time) {

@@ -168,3 +183,3 @@ return this.setMinutes(this.setHours(date, this.getHours(time)), this.getMinutes(time));

end: endOfWeek(now, { locale: this.locale })
}, { locale: this.locale }).map(function (day) { return format(day, "EEEEEE", { locale: _this.locale }); });
}).map(function (day) { return format(day, "EEEEEE", { locale: _this.locale }); });
};

@@ -199,3 +214,3 @@ DateFnsUtils.prototype.getWeekArray = function (date) {

DateFnsUtils.prototype.getCalendarHeaderText = function (date) {
return format(date, "MMMM yyyy", { locale: this.locale });
return format(date, this.yearMonthFormat, { locale: this.locale });
};

@@ -211,2 +226,5 @@ DateFnsUtils.prototype.getYearText = function (date) {

};
DateFnsUtils.prototype.getMonthText = function (date) {
return format(date, "MMMM", { locale: this.locale });
};
DateFnsUtils.prototype.getDayText = function (date) {

@@ -213,0 +231,0 @@ return format(date, "d", { locale: this.locale });

12

package.json
{
"name": "@date-io/date-fns",
"version": "1.0.1",
"version": "1.0.2",
"description": "Abstraction over common javascript date management libraries",

@@ -33,13 +33,13 @@ "main": "build/index.js",

"peerDependencies": {
"date-fns": "2.0.0-alpha.21"
"date-fns": "2.0.0-alpha.27"
},
"dependencies": {
"@date-io/core": "^1.0.1"
"@date-io/core": "^1.0.2"
},
"devDependencies": {
"date-fns": "2.0.0-alpha.21",
"date-fns": "^2.0.0-alpha.27",
"rollup": "^0.66.6",
"typescript": "^3.1.4"
"typescript": "^3.2.4"
},
"gitHead": "85bac554cf41ec50e135e2123f1d1c6691bcaa7f"
"gitHead": "db6ddb0b74fefc66aa681335c5880cdc656412b7"
}

@@ -21,2 +21,3 @@ import addDays from "date-fns/addDays";

import setMinutes from "date-fns/setMinutes";
import setMonth from "date-fns/setMonth";
import setSeconds from "date-fns/setSeconds";

@@ -39,2 +40,6 @@ import setYear from "date-fns/setYear";

public yearFormat = "yyyy";
public yearMonthFormat = "MMMM yyyy";
public dateTime12hFormat = "MMMM do hh:mm aaaa";

@@ -55,3 +60,3 @@

// Note: date-fns input types are more lenient than this adapter, so we need to expose our more
// strict signature and delegate to the more lenient sigtature. Otherwise, we have downstream type errors upon usage.
// strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.

@@ -63,7 +68,7 @@ public addDays(value: Date, count: number) {

public isValid(value: any) {
return isValid(value);
return isValid(this.date(value));
}
public getDiff(value: Date, comparing: Date) {
return differenceInMilliseconds(value, comparing);
public getDiff(value: Date, comparing: Date | string) {
return differenceInMilliseconds(value, this.date(comparing));
}

@@ -191,2 +196,6 @@

public setMonth(date: Date, count: number) {
return setMonth(date, count);
}
public getMeridiemText(ampm: "am" | "pm") {

@@ -204,2 +213,14 @@ return ampm === "am" ? "AM" : "PM";

public getMonthArray(date: Date) {
const firstMonth = startOfYear(date);
const monthArray = [firstMonth];
while (monthArray.length < 12) {
const prevMonth = monthArray[monthArray.length - 1];
monthArray.push(this.getNextMonth(prevMonth));
}
return monthArray;
}
public mergeDateAndTime(date: Date, time: Date) {

@@ -214,9 +235,6 @@ return this.setMinutes(

const now = new Date();
return eachDayOfInterval(
{
start: startOfWeek(now, { locale: this.locale }),
end: endOfWeek(now, { locale: this.locale })
},
{ locale: this.locale }
).map(day => format(day, "EEEEEE", { locale: this.locale }));
return eachDayOfInterval({
start: startOfWeek(now, { locale: this.locale }),
end: endOfWeek(now, { locale: this.locale })
}).map(day => format(day, "EEEEEE", { locale: this.locale }));
}

@@ -259,3 +277,3 @@

public getCalendarHeaderText(date: Date) {
return format(date, "MMMM yyyy", { locale: this.locale });
return format(date, this.yearMonthFormat, { locale: this.locale });
}

@@ -275,2 +293,6 @@

public getMonthText(date: Date) {
return format(date, "MMMM", { locale: this.locale });
}
public getDayText(date: Date) {

@@ -277,0 +299,0 @@ return format(date, "d", { locale: this.locale });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc