Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@splunk/moment
Advanced tools
A package of Moment and Moment Timezone plugins for Splunk Enterprise timezones, and formatting for locales with second and millisecond precision.
Install the package:
npm install @splunk/moment
Import moment from the Splunk UI package. This provides a Moment class with the timezone and timezone util plugins.
import moment from '@splunk/moment';
Create new moment instances in the server timezone and locale.
const time1 = moment.newSplunkTime({time: 1490500800});
const time2 = moment.newSplunkTime({time: '10/10/2017', format: 'l'});
Manipulate and query times using the Moment API.
time1.subtract(1, 'day').startOf('day';);
const isBefore = time1.isBefore(time2);
Format Times using second or millisecond precision
const displayValue = time1.splunkFormat('lls');
If used in an environment without the window.$C
properties set by splunkweb
, there are
functions to setup and use the plugins with raw timezone data from Splunk Enterprise.
The timezone data can be retrieved from services/search/timeparser/tz
. To access this
service from the client, the endpoint must be exposed in web.conf.
For example:
http://localhost:8000/en-US/splunkd/__raw/services/search/timeparser/tz
Set this data as the default Splunk Enterprise timezone, which can be used for creating and manipulating times.
const splunkTimezoneName = moment.setDefaultSplunkTimezone(zoneData);
const time = moment.newSplunkTime({time: 1490500800}); // uses the default timezone
const nowInTokyo = moment.tz('Asia/Tokyo').locale('ja_JP');
const nowAtServer = nowInTokyo.clone().tz(splunkTimezoneName).locale('en_US');
FAQs
Splunk timezone and formatting plugins for moment.js
The npm package @splunk/moment receives a total of 1,182 weekly downloads. As such, @splunk/moment popularity was classified as popular.
We found that @splunk/moment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.