Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(dur.toObject().milliseconds: ?number);
(dur.toObject({ includeConfig: true }).locale: string);
(dur.toObject({ includeConfig: true }).numberingSystem: ?string);
(dur.toObject({ includeConfig: true }).conversionAccuracy: ?string);
// $ExpectError
dur.toObject({ includeConfig: false }).locale;
// $ExpectError
dur.toObject({ includeConfig: false }).numberingSystem;
// $ExpectError
dur.toObject({ includeConfig: false }).conversionAccuracy;
(dur.toString(): string);
(Interval.after(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.after(DateTime.utc(), { year: 1 }): Interval);
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
(Info.weekdaysFormat("long"): Array);
(Info.weekdaysFormat("narrow", { locale: "de-DE" }): Array);
(Info.weekdaysFormat("short", { numberingSystem: "arab" }): Array);
(Info.weekdaysFormat("long", {
numberingSystem: "latn",
outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.weekdaysFormat("long", { foo: "bar" }): Array);
(DateTime.local().toJSDate(): Date);
DateTime.local(2012).toJSDate();
DateTime.local(2012, 1, 16).toJSDate();
(DateTime.utc().toJSDate(): Date);
DateTime.utc(2012).toJSDate();
DateTime.utc(2012, 1, 16).toJSDate();
var date: DateTime = DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT");
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", {});
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", { zone: "America/Chicago" });
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", { zone: new CustomZone() });
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", { locale: "en-US" });
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", {
zone: "America/Chicago",
setZone: true,
locale: "en-US",
outputCalendar: "gregory",
numberingSystem: "buddhist"
});
// $ExpectError
(Info.weekdaysFormat("long"): Array);
(Info.weekdaysFormat("narrow", { locale: "de-DE" }): Array);
(Info.weekdaysFormat("short", { numberingSystem: "arab" }): Array);
(Info.weekdaysFormat("long", {
numberingSystem: "latn",
outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.weekdaysFormat("long", { foo: "bar" }): Array);
(DateTime.local().toJSDate(): Date);
DateTime.local(2012).toJSDate();
DateTime.local(2012, 1, 16).toJSDate();
(DateTime.utc().toJSDate(): Date);
DateTime.utc(2012).toJSDate();
DateTime.utc(2012, 1, 16).toJSDate();
var date: DateTime = DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT");
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", {});
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", { zone: "America/Chicago" });
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", { zone: new CustomZone() });
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", { locale: "en-US" });
DateTime.fromHTTP("Sun, 06 Nov 1994 08:49:37 GMT", {
zone: "America/Chicago",
setZone: true,
locale: "en-US",
outputCalendar: "gregory",
numberingSystem: "buddhist"
});
// $ExpectError
DateTime.fromHTTP();
(date.toSQLDate(): string);
(date.toSQLTime(): string);
(date.toSQLTime({}): string);
(date.toSQLTime({ includeZone: true, includeOffset: true }): string);
// $ExpectError
(date.toSQLTime({ blah: true }): string);
(date.toString(): string);
(date.toUTC(): DateTime);
(date.toUTC(32): DateTime);
(date.toUTC(32, { keepCalendarTime: true }): DateTime); // Support deprecated name for keepLocalTime
(date.toUTC(32, { keepLocalTime: true }): DateTime);
(date.until(DateTime.utc()): Interval);
(date.valueOf(): number);
(Duration.fromISO("lkasdfa"): Duration);
(Duration.fromISO("lkasdfa", {
locale: "de-DE",
numberingSystem: "gujr",
conversionAccuracy: "casual"
}): Duration);
// $ExpectError
(Duration.fromISO(): Duration);
// $ExpectError
(Duration.fromISO("lkasdfa", { foo: "bar" }): Duration);
(Duration.fromObject({ year: 1 }): Duration);
(Duration.fromObject({ years: 1 }): Duration);
outputCalendar: 2,
});
// $ExpectError
DateTime.fromFormat('12/15/2017, 12:47:25 PM', 'dd/MM/yyyy h:mm:ss a', {
numberingSystem: 2,
});
var date: DateTime = DateTime.invalid("test");
// $ExpectError
DateTime.invalid();
// Flow 0.40 - 0.45 allows these but they're incorrect...bug!
// DateTime.max();
// DateTime.min();
var date = DateTime.max(DateTime.local(), DateTime.utc(), DateTime.utc());
var date = DateTime.min(DateTime.local(), DateTime.utc(), DateTime.utc());
// $ExpectError
var date = DateTime.max(DateTime.local(), null, DateTime.utc());
// $ExpectError
var date = DateTime.min(DateTime.local(), null, DateTime.utc());
(date.day: number);
(date.daysInMonth: number);
(date.daysInYear: number);
(date.hour: number);
(date.invalidReason: ?string);
(date.isInDST: boolean);
(date.isInLeapYear: boolean);
(date.isOffsetFixed: boolean);
(date.isValid: boolean);
(date.locale: string);
if (isEmpty(cfpDates)) {
return 'not-started'
}
// By default 'Europe/Paris' because now it should be mandatory
const eventTimezone = get(address, 'timezone.id', 'Europe/Paris')
const start = DateTime.fromJSDate(cfpDates.start.toDate()).setZone(eventTimezone)
const end = DateTime.fromJSDate(cfpDates.end.toDate())
.setZone(eventTimezone)
.plus({
hours: 23,
minutes: 59,
seconds: 59,
})
const today = DateTime.utc().setZone(userTimezone)
if (today < start) {
return 'not-started'
}
if (today > end) {
return 'closed'
}
return 'opened'
}
User.prototype.validateToken = async function(type, token, use, transaction) {
const credential = await models.Credential.findOne({
where: {
type,
identifier: token,
secret: token,
userId: this.id,
deletedAt: {
[Op.eq]: null
}
}
});
if(!credential) {
throw new User.errors.InvalidToken();
}
if(credential.expiresAt && credential.expiresAt.toISOString() < DateTime.utc().toISO()) {
throw new User.errors.ExpiredToken();
}
if(use) {
await credential.update({ deletedAt: new Date() }, { transaction });
}
return true;
};
return;
}
const data: CompletedDataPlayload = {
context: {
extensions: {
[ContextExtensionsDefinition.length]: this.duration,
[ContextExtensionsDefinition.sessionId]: this.sessionId,
[ContextExtensionsDefinition.completionTreshold]: truncateDecimalDigits(
this.getCompletionThreshold(),
),
},
},
result: {
completion: true,
duration: Interval.fromDateTimes(this.startedAt!, DateTime.utc())
.toDuration('milliseconds')
.toISO(),
extensions: {
[ResultExtensionsDefinition.time]: truncateDecimalDigits(time),
[ResultExtensionsDefinition.progress]: 1,
[ResultExtensionsDefinition.playedSegment]: this.getPlayedSegment(),
},
},
verb: {
display: {
'en-US': 'completed',
},
id: VerbDefinition.completed,
},
};
high_school: faker.random.words(3),
style: faker.random.words(2),
type: faker.random.words(2),
roof_type: faker.random.words(2),
exterior_material: faker.random.words(2),
foundation_type: faker.random.words(2),
utilities: faker.random.words(5),
parking: faker.random.words(2),
patio: faker.random.words(6),
yard: faker.random.words(6),
sprinklers: faker.random.words(3),
lot_depth: faker.random.number(),
lot_width: faker.random.word(),
parcel_number: faker.random.word(),
tax_history: faker.random.word(),
createdAt: DateTime.utc().toString(),
updatedAt: DateTime.utc().toString()
};
const savedHomes = await this.saveAll([home]);
const medias = [];
for (let i = 2; i < 6; ++i) {
if (!row[i]) {
continue;
}
medias.push({
homeId: savedHomes[0].id.toString(),
originalname: faker.system.commonFileName('jpeg'),
mimetype: 'image/fake',