node-red-contrib-dayjs
Advanced tools
Comparing version 0.0.2 to 0.1.0
21
day.js
@@ -12,2 +12,3 @@ module.exports = function(RED) { | ||
var toObject = require('dayjs/plugin/toObject') | ||
var relativeTime = require('dayjs/plugin/relativeTime') | ||
dayjs.extend(utc) | ||
@@ -18,2 +19,3 @@ dayjs.extend(timezone) | ||
dayjs.extend(toObject) | ||
dayjs.extend(relativeTime) | ||
@@ -59,2 +61,17 @@ this.outputFormat = config.outputFormat || 'ISOString'; | ||
case 'unix_millis': | ||
return input.valueOf() | ||
case 'unix': | ||
return input.unix() | ||
case 'fromNow': | ||
return input.fromNow() | ||
case 'toNow': | ||
return input.toNow() | ||
case 'daysInMonth': | ||
return input.daysInMonth() | ||
case 'Costum': | ||
@@ -93,5 +110,5 @@ return input.format(costumFormatOutput) | ||
let input = msg[msg_input_property] | ||
let day = parsePayload(msg_input_property) | ||
let day = parsePayload(input) | ||
let day_tz = alterTimezone(day,node.outputTimezone,false) | ||
@@ -98,0 +115,0 @@ let day_output = dayjs() |
{ | ||
"name": "node-red-contrib-dayjs", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Wrapper of dayjs for Node-RED", | ||
"main": "day.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "mocha \"test/**/*_spec.js\"" | ||
}, | ||
@@ -25,3 +25,3 @@ "repository": { | ||
"node": ">=14" | ||
}, | ||
}, | ||
"node-red": { | ||
@@ -35,3 +35,9 @@ "version": ">=3.0.0", | ||
"dayjs": "^1.11.10" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^10.4.0", | ||
"node-red": "^3.1.8", | ||
"node-red-node-test-helper": "^0.3.3", | ||
"should": "^13.2.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
17237
6
221
1
4