本文整理匯總了TypeScript中moment-timezone.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getDate
protected getDate(date: any, defaultValue: any = null) {
if (!date) {
return defaultValue;
}
return moment(date)
.tz(this.timezone)
.format(DATE_FORMAT);
}
示例2: diffWithCurrentTime
function diffWithCurrentTime(team: Team) {
let currentTime = moment();
let endTime = moment(team.endQuestDate);
return endTime.diff(currentTime, 'seconds');
}
示例3: it
it('understands cron intervals with a timezone when last run is the same as the interval', () => {
job.attrs.lastRunAt = new Date('2015-01-01T06:00:00-00:00');
job.repeatEvery('0 6 * * *', {
timezone: 'GMT'
});
job.computeNextRunAt();
expect(moment(job.attrs.nextRunAt).tz('GMT').hour()).to.be(6);
expect(moment(job.attrs.nextRunAt).toDate().getDate()).to.be(moment(job.attrs.lastRunAt).add(1, 'days').toDate().getDate());
});
示例4: downloadEarnings
public async downloadEarnings(): Promise<void> {
const date: Date = moment().tz("America/New_York").toDate();
const dateStr: string = moment().tz("America/New_York").format("YYYY-MM-DD");
const dateThreshold: Date = moment().add(5, "days").tz("America/New_York").toDate();
const currentSeason = await this.sql.getSelectedSeason(undefined);
if (currentSeason === undefined || currentSeason.getEndDate() < date) {
return;
}
const moviesToGet = Enumerable.from(currentSeason.movies)
.where((m) => m.releaseDate <= dateThreshold)
.orderByDescending((m) => m.releaseDate)
.toArray();
let earnings: Earning[] = [];
for (const url of currentSeason.urls) {
const html = await this.http.download(url.url, {});
const rows = MojoParser.parse(html);
const earningsToAdd = MojoParser.getEarnings(rows, moviesToGet);
earnings = earnings.concat(earningsToAdd);
}
for (const earning of earnings) {
const value = accounting.formatMoney(earning.gross, "$", 0);
this.output.write(`${earning.movie.name}: ${value}\n`);
}
await this.sql.deleteEarningsForDate(dateStr);
const addPromise = this.sql.addEarningsForMovies(earnings);
this.output.write("\n");
const ratingsPromises: Array<Promise<void>> = [];
for (const movie of moviesToGet) {
if (movie.metacriticUrl === undefined) {
continue;
}
const rating = await this.getRating(movie.metacriticUrl, 0);
if (rating === undefined) {
continue;
}
ratingsPromises.push(this.sql.updateRatingForMovie(movie, rating));
this.output.write(`${movie.name}: ${rating}%\n`);
}
await addPromise;
await Promise.all(ratingsPromises);
}
示例5: parse
parse(value: string): NgbDateStruct {
const inst: any = moment(value, DATE_FORMAT);
return {
year: inst.year(),
month: inst.month() + 1, // moment return 0-11 for month
day: inst.date(),
};
}
示例6: endDateBeforeRender
endDateBeforeRender($view, $dates): void {
if (this.editor.StartDate) {
const activeDate: moment.Moment = moment(this.editor.StartDate).subtract(1, $view).add(1, "minute");
$dates.filter(date => date.localDateValue() <= activeDate.valueOf())
.forEach(date => date.selectable = false);
}
}
示例7: startDateBeforeRender
startDateBeforeRender($dates): void {
if (this.editor.EndDate) {
const activeDate: moment.Moment = moment(this.editor.EndDate);
$dates.filter(date => date.localDateValue() >= activeDate.valueOf())
.forEach(date => date.selectable = false);
}
}
示例8: format
format(date: NgbDateStruct): string {
if (date == null) {
return '';
}
const inst: any = moment();
inst.set('year', date.year);
inst.set('month', date.month - 1); // moment month is from 0-11
inst.set('date', date.day);
return inst.format(DATE_FORMAT);
}
示例9: moment
export const upsertDevice = (memberid: string, device: string): Promise<any> =>
DeviceTrackingModel.findOneAndUpdate(
{
memberid: memberid,
device: device
},
{
$set: {
memberid: memberid,
device: device,
lastUsed: moment()
}
},
UPSERT_OPTIONS);
示例10: it
it("#formattedDate", () => {
const dateTimeFormClass: DatetimeFormClass = new DatetimeFormClass($scope);
const dateTime: moment.Moment = moment("2018-12-03");
expect(dateTimeFormClass.formattedDate(dateTime)).toEqual("3 December 2018");
});