Socket
Socket
Sign inDemoInstall

chartjs-adapter-luxon

Package Overview
Dependencies
7
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

dist/chartjs-adapter-luxon.esm.js

16

dist/chartjs-adapter-luxon.js
/*!
* chartjs-adapter-luxon v0.2.1
* chartjs-adapter-luxon v0.2.2
* https://www.chartjs.org

@@ -10,7 +10,9 @@ * (c) 2020 Chart.js Contributors

typeof define === 'function' && define.amd ? define(['chart.js', 'luxon'], factory) :
(global = global || self, factory(global.Chart, global.luxon));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Chart, global.luxon));
}(this, (function (Chart, luxon) { 'use strict';
Chart = Chart && Object.prototype.hasOwnProperty.call(Chart, 'default') ? Chart['default'] : Chart;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Chart__default = /*#__PURE__*/_interopDefaultLegacy(Chart);
const FORMATS = {

@@ -29,3 +31,3 @@ datetime: luxon.DateTime.DATETIME_MED_WITH_SECONDS,

Chart._adapters._date.override({
Chart__default['default']._adapters._date.override({
_id: 'luxon', // DEBUG

@@ -47,3 +49,3 @@

if (Chart.helpers.isNullOrUndef(value)) {
if (value === null || typeof value === 'undefined') {
return null;

@@ -89,3 +91,5 @@ }

if (unit === 'isoWeek') {
return this._create(time).isoWeekday(weekday).valueOf();
weekday = Math.trunc(Math.min(Math.max(0, weekday), 6));
const dateTime = this._create(time);
return dateTime.minus({ days: (dateTime.weekday < weekday ? 7 : 0) + dateTime.weekday - weekday }).startOf('day').valueOf();
}

@@ -92,0 +96,0 @@ return unit ? this._create(time).startOf(unit).valueOf() : time;

/*!
* chartjs-adapter-luxon v0.2.1
* chartjs-adapter-luxon v0.2.2
* https://www.chartjs.org

@@ -7,2 +7,2 @@ * (c) 2020 Chart.js Contributors

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chart.js"),require("luxon")):"function"==typeof define&&define.amd?define(["chart.js","luxon"],t):t((e=e||self).Chart,e.luxon)}(this,(function(e,t){"use strict";e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;const r={datetime:t.DateTime.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:t.DateTime.TIME_WITH_SECONDS,minute:t.DateTime.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};e._adapters._date.override({_id:"luxon",_create:function(e){return t.DateTime.fromMillis(e,this.options)},formats:function(){return r},parse:function(r,n){const i=this.options;if(e.helpers.isNullOrUndef(r))return null;const o=typeof r;return"number"===o?r=this._create(r):"string"===o?r="string"==typeof n?t.DateTime.fromFormat(r,n,i):t.DateTime.fromISO(r,i):"object"!==o||r instanceof t.DateTime?r instanceof Date&&(r=t.DateTime.fromJSDate(r,i)):r=t.DateTime.fromObject(r),r.isValid?r.valueOf():null},format:function(e,t){const r=this._create(e);return"string"==typeof t?r.toFormat(t,this.options):r.toLocaleString(t)},add:function(e,t,r){const n={};return n[r]=t,this._create(e).plus(n).valueOf()},diff:function(e,t,r){return this._create(e).diff(this._create(t)).as(r).valueOf()},startOf:function(e,t,r){return"isoWeek"===t?this._create(e).isoWeekday(r).valueOf():t?this._create(e).startOf(t).valueOf():e},endOf:function(e,t){return this._create(e).endOf(t).valueOf()}})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chart.js"),require("luxon")):"function"==typeof define&&define.amd?define(["chart.js","luxon"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Chart,e.luxon)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e);const i={datetime:t.DateTime.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:t.DateTime.TIME_WITH_SECONDS,minute:t.DateTime.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};r.default._adapters._date.override({_id:"luxon",_create:function(e){return t.DateTime.fromMillis(e,this.options)},formats:function(){return i},parse:function(e,n){const r=this.options;if(null==e)return null;const i=typeof e;return"number"===i?e=this._create(e):"string"===i?e="string"==typeof n?t.DateTime.fromFormat(e,n,r):t.DateTime.fromISO(e,r):"object"!==i||e instanceof t.DateTime?e instanceof Date&&(e=t.DateTime.fromJSDate(e,r)):e=t.DateTime.fromObject(e),e.isValid?e.valueOf():null},format:function(e,t){const n=this._create(e);return"string"==typeof t?n.toFormat(t,this.options):n.toLocaleString(t)},add:function(e,t,n){const r={};return r[n]=t,this._create(e).plus(r).valueOf()},diff:function(e,t,n){return this._create(e).diff(this._create(t)).as(n).valueOf()},startOf:function(e,t,n){if("isoWeek"===t){n=Math.trunc(Math.min(Math.max(0,n),6));const t=this._create(e);return t.minus({days:(t.weekday<n?7:0)+t.weekday-n}).startOf("day").valueOf()}return t?this._create(e).startOf(t).valueOf():e},endOf:function(e,t){return this._create(e).endOf(t).valueOf()}})}));

@@ -5,5 +5,8 @@ {

"description": "Chart.js adapter to use Luxon for time functionalities",
"version": "0.2.1",
"version": "0.2.2",
"license": "MIT",
"main": "dist/chartjs-adapter-luxon.js",
"jsdelivr": "dist/chartjs-adapter-luxon.min.js",
"unpkg": "dist/chartjs-adapter-luxon.min.js",
"module": "dist/chartjs-adapter-luxon.esm.js",
"repository": {

@@ -20,3 +23,2 @@ "type": "git",

"files": [
"bower.json",
"dist/*.js"

@@ -31,3 +33,2 @@ ],

"gulp-eslint": "^5.0.0",
"gulp-file": "^0.4.0",
"karma": "^4.0.1",

@@ -34,0 +35,0 @@ "karma-firefox-launcher": "^1.1.0",

@@ -31,5 +31,5 @@ # chartjs-adapter-luxon

```html
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@1.15.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@0.2.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@1.22.1"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@0.2.1"></script>
```

@@ -36,0 +36,0 @@

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