Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/time-lib

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/time-lib - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.4.0](https://github.com/NaturalCycles/time-lib/compare/v1.3.0...v1.4.0) (2019-07-12)
### Features
* .isoWeekday setter ([d6367e0](https://github.com/NaturalCycles/time-lib/commit/d6367e0))
# [1.3.0](https://github.com/NaturalCycles/time-lib/compare/v1.2.1...v1.3.0) (2019-07-09)

@@ -2,0 +9,0 @@

4

dist/plugin/isoWeekday.d.ts

@@ -11,4 +11,8 @@ import { PluginFunc } from 'dayjs';

isoWeekday(): number;
/**
* Set date to NEXT date that satisfies the weekday.
*/
isoWeekday(setWeekday: number): this;
}
}
export declare const isoWeekdayPlugin: PluginFunc;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isoWeekdayPlugin = (_opt, dayjsClass) => {
dayjsClass.prototype.isoWeekday = function () {
dayjsClass.prototype.isoWeekday = function (setWeekday) {
const { $W } = this;
return $W <= 0 ? $W + 7 : $W;
const weekday = $W <= 0 ? $W + 7 : $W;
if (setWeekday) {
let diff = setWeekday - weekday;
if (diff < 0)
diff += 7;
return this.add(diff, 'day');
}
return weekday;
};
};
//# sourceMappingURL=isoWeekday.js.map

2

package.json

@@ -34,3 +34,3 @@ {

},
"version": "1.3.0",
"version": "1.4.0",
"description": "Date/time related API, based on DayJS",

@@ -37,0 +37,0 @@ "keywords": [

@@ -12,2 +12,7 @@ import { Dayjs, PluginFunc } from 'dayjs'

isoWeekday (): number
/**
* Set date to NEXT date that satisfies the weekday.
*/
isoWeekday (setWeekday: number): this
}

@@ -17,6 +22,15 @@ }

export const isoWeekdayPlugin: PluginFunc = (_opt, dayjsClass) => {
dayjsClass.prototype.isoWeekday = function (this: Dayjs) {
dayjsClass.prototype.isoWeekday = function (this: Dayjs, setWeekday?: number) {
const { $W } = this as any
return $W <= 0 ? $W + 7 : $W
const weekday = $W <= 0 ? $W + 7 : $W
if (setWeekday) {
let diff = setWeekday - weekday
if (diff < 0) diff += 7
return this.add(diff, 'day')
}
return weekday
}
}

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