本文整理汇总了TypeScript中dateformat.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: dateFormat
.replace(/\$\(date(\:([^\)]+))?\)/i, ($0, $1, $2) => {
if ($2) {
try {
return dateFormat(new Date(), $2);
}
catch (e) { }
}
return dateFormat(new Date(), 'isoDateTime')
}));
示例2: sendMail
private static sendMail(letter: Letter, billPath: string, callback: (error: Error) => void) {
var nodemailer = require("nodemailer");
var jade = require('jade');
var dateFormat = require('dateformat');
var prettyPassedToPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var prettyDispatchedByPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var options = { pretty: true,
invoiceNumber: letter.invoiceNumber,
serverPath: Config.getBaseUri()
};
jade.renderFile(Config.getBasePath() + '/views/email.jade', options, function (err, html) {
if (err) {
callback(err);
return;
}
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = Config.getNodemailerTransport();
var message = "Please see the HTML Version of this email for more information.";
// setup e-mail data with unicode symbols
var mailOptions = {
from: "hello@milsapp.com", // sender address
to: letter.issuer.email, // list of receivers
subject: "Mils Billing", // Subject line
text: message, // plaintext body
html: html, // html body,
attachments : [{fileName: 'Invoice.pdf', filePath: billPath}] // TODO: Check whether this is correct
};
// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
// if you don't want to use this transport object anymore, uncomment following line
smtpTransport.close(); // shut down the connection pool, no more messages
callback(error);
});
});
}
示例3: notifyCustomerViaEmail
public static notifyCustomerViaEmail(letter: Letter, callback: (error: Error) => void) {
var nodemailer = require("nodemailer");
var jade = require('jade');
var dateFormat = require('dateformat');
var prettyPassedToPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var prettyDispatchedByPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var options = { pretty: true,
destination: letter.recipient.countryIso,
passedToPrintingProviderAt: prettyPassedToPrintingProviderAt,
dispatchedByPrintingProviderAt: prettyDispatchedByPrintingProviderAt,
serverPath: Config.getBaseUri()
};
jade.renderFile(Config.getBasePath() + '/views/dispatched_email.jade', options, function (err, html) {
if (err) throw err;
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = Config.getNodemailerTransport();
var message = "Your letter to " + letter.recipient.countryIso + " from " + prettyPassedToPrintingProviderAt + " was dispatched at " + prettyDispatchedByPrintingProviderAt;
// setup e-mail data with unicode symbols
var mailOptions = {
from: "hello@milsapp.com", // sender address
to: letter.issuer.email, // list of receivers
subject: "Your Letter was Dispatched", // Subject line
text: message, // plaintext body
html: html // html body
};
// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
// if you don't want to use this transport object anymore, uncomment following line
smtpTransport.close(); // shut down the connection pool, no more messages
callback(error);
});
});
}
示例4: receiveMsg
/**
* メッセージ受け取ったら、DBに格納&全員に送信
*/
private receiveMsg(ws: WebSocket, data: any, flags: {binary: boolean}) {
if (!this.validateMsg(data, flags.binary)) {
return;
}
const log = {
msg: data,
date: dateFormat(new Date(), "m/dd HH:MM")
};
this.collection.insert(log);
this.wss.clients.forEach(ws => {
ws.send(JSON.stringify({
type: WSResType.log,
value: log
}));
});
}
示例5: dateFormat
static dateFormat(date:Date) {
return dateFormatLib(date, "yyyy-mm-dd");
}
示例6: dateFormatter
function dateFormatter(date:string):string {
var now = Today.fromNumber(parseInt(date, 10)).toDate();
return dateFormat(now, "dddd, mmmm dS")
}
示例7: millisToString
public millisToString(millis): string {
let date: Date = this.millisToDate(millis);
var dateFormat = require('dateformat');
return dateFormat(date, 'dd.mm.yyyy hh:MM');
}
示例8: dateformat
transform(value: string, args:string[]): any {
return dateformat(Date.parse(value), args[0]);
}
示例9: __log
function __log(category: string, message: string): void {
let timeString = dateFormat(new Date(), 'yyyy-mm-dd HH:MM:ss.l');
console.log(`[${timeString}] [${category}] ${message}`);
}
示例10: dateFormat
const now = () => {
const date = dateFormat(new Date(), '[dd/mm/yyyy hh:MM:ss]')
return chalk.reset(date)
}