Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(packageInfo, tag) {
this.name = packageInfo.name;
this.tag = tag;
this.version = packageInfo['dist-tags'][this.tag];
this.dateTime = DateTime.fromISO(
packageInfo.time[this.version], { locale: 'de', zone: 'Europe/Zurich' });
this.targetDir = join(__dirname, 'browser', this.tag);
this.installName = `sbb-angular-showcase-${this.tag}@npm:sbb-angular-showcase@${this.tag}`;
this.location = join(__dirname, 'node_modules', `sbb-angular-showcase-${this.tag}`);
}
const formatDate = str => {
return DateTime.fromISO(str).toLocaleString(DateTime.DATETIME_MED)
}
export async function getRealTimeInfo (stopCode: string, directionFilter?: Direction): Promise> {
const response = await got(SERVICE_URI, {
query: {
action: 'forecast',
stop: stopCode,
ver: 2,
encrypt: false
}
})
const document: StopRealTimeInfoResponse = await parseXml(response.body)
const trams : Array = []
const requestTime = DateTime.fromISO(document.stopInfo.$.created, { zone: 'Europe/Dublin' })
document.stopInfo.direction.forEach((direction) => {
direction.tram.forEach((tram) => {
const dueMins = tram.$.dueMins === 'DUE' ? 0 : Number(tram.$.dueMins)
trams.push({
direction: direction.$.name,
destination: tram.$.destination,
arrivingInMinutes: dueMins,
expectedArrivalTime: requestTime.plus({ minutes: dueMins }).toString()
})
})
})
if (directionFilter) {
return trams.filter(tram => tram.direction === directionFilter)
}
const calculateAge = p => {
const now = DateTime.local();
const bd = DateTime.fromISO(p.birthDay);
const age = now.diff(bd, "years").toObject().years;
return {
...p,
age
};
};
getDateString() {
return DateTime.fromISO(this.CreatedAt).toLocaleString(DateTime.DATETIME_MED);
}
import { select, boolean } from '@storybook/addon-knobs';
import { storiesOf } from '@storybook/react';
import { DateTime } from 'luxon';
import React from 'react';
import { Axis, Chart, getAxisId, getSpecId, LineSeries, Position, ScaleType, Settings } from '../src';
const today = new Date().getTime();
const UTC_DATE = DateTime.fromISO('2019-01-01T00:00:00.000Z').toMillis();
const UTC_PLUS8_DATE = DateTime.fromISO('2019-01-01T00:00:00.000+08:00', {
setZone: true,
}).toMillis();
const UTC_MINUS8_DATE = DateTime.fromISO('2019-01-01T00:00:00.000-08:00', {
setZone: true,
}).toMillis();
const DAY_INCREMENT_1 = 1000 * 60 * 60 * 24;
const UTC_DATASET = new Array(10).fill(0).map((d, i) => {
return [UTC_DATE + DAY_INCREMENT_1 * i, i % 5];
});
const CURRENT_TIMEZONE_DATASET = new Array(10).fill(0).map((d, i) => {
return [today + DAY_INCREMENT_1 * i, i % 5];
});
const OTHER_PLUS8_TIMEZONE_DATASET = new Array(10).fill(0).map((d, i) => {
return [UTC_PLUS8_DATE + DAY_INCREMENT_1 * i, i % 5];
});
const OTHER_MINUS8_TIMEZONE_DATASET = new Array(10).fill(0).map((d, i) => {
return [UTC_MINUS8_DATE + DAY_INCREMENT_1 * i, i % 5];
});
render () {
const { t } = this.context
const { mkrMigrationReminderTimestamp, string: balanceString, symbol } = this.props
if (mkrMigrationReminderTimestamp) {
const reminderDateTime = DateTime.fromISO(mkrMigrationReminderTimestamp, {
zone: 'UTC',
})
if (reminderDateTime > DateTime.utc()) {
return null
}
}
if (!balanceString || !symbol) {
return null
}
if (balanceString === '0') {
return null
}
return (
.map(r => (
<p> setSelectedRecord(r.id)}
>
{new DateTime.fromISO(r.timestamp).toLocaleString(
DateTime.TIME_SIMPLE
)}{" "}
- {titleCase(r.category)}: {r.contents}
</p>
))}
quickDate(iso) {
return DateTime.fromISO(iso).toFormat('d MMM kkkk');
}
renderDeleteModal() {
getDateString() {
return DateTime.fromISO(this.CreatedAt).toLocaleString(DateTime.DATETIME_MED);
}