react-cron-generator
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -8,3 +8,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import React, { Component } from 'react'; | ||
import cronstrue from 'cronstrue'; | ||
import cronstrue from 'cronstrue/i18n'; | ||
import { metadata, loadHeaders } from './meta'; | ||
@@ -25,3 +25,4 @@ import './cron-builder.css'; | ||
_this.state = { | ||
headers: loadHeaders(_this.props.options) | ||
headers: loadHeaders(_this.props.options), | ||
locale: _this.props.locale ? _this.props.locale : 'en' | ||
}; | ||
@@ -57,2 +58,6 @@ return _this; | ||
} | ||
if (this.props.translateFn && !this.props.locale) { | ||
console.log('Warning !!! locale not set while using translateFn'); | ||
} | ||
} | ||
@@ -109,3 +114,5 @@ }, { | ||
value: function getVal() { | ||
var val = cronstrue.toString(this.state.value.toString().replace(/,/g, ' ').replace(/!/g, ',')); | ||
var val = cronstrue.toString(this.state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), { | ||
locale: this.state.locale | ||
}); | ||
@@ -112,0 +119,0 @@ if (val.search('undefined') === -1) { |
{ | ||
"name": "react-cron-generator", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Simple react component to generate cron expression", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -65,2 +65,3 @@ # react-cron-generator | ||
| translateFn | translate function callback | method | No | ||
| locale | locale for cronstrue | en | No | ||
| options | Options for Cron component, *Must pass a valid cron value for available headers | All available headers | No | ||
@@ -70,4 +71,6 @@ | ||
Expects a method. Use this prop for localization support. `react-cron-generator` will call this method for every key. List of keys are available here (https://github.com/sojinantony01/react-cron-generator/tree/master/src/lib/localization/translation.json) | ||
Expects a method. Use this prop for localization support. `react-cron-generator` will call this method for every key. List of keys are available [here](https://github.com/sojinantony01/react-cron-generator/tree/master/src/lib/localization/translation.json) | ||
`locale` option should be set for correct `ResultText` translation. Please visit [cronstrue](https://github.com/bradymholt/cRonstrue) for supported locales. | ||
## Options | ||
@@ -74,0 +77,0 @@ |
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
40448
964
94