serverDocument.games.sort((a, b) => b.time_played - a.time_played) .slice(0, 5) .map(a => { const timePlayed = a.time_played * 15; return `**${a._id}** played for ${moment.duration(timePlayed, "minutes").humanize()} total`; })
$.vidview.dr.daterangepicker({ startDate:$.ccio.timeObject().subtract(moment.duration("24:00:00")), endDate:$.ccio.timeObject().add(moment.duration("24:00:00")), timePicker: true, timePickerIncrement: 30, locale: { format: 'MM/DD/YYYY h:mm A' } },function(start, end, label){ $.vidview.launcher.click() $.vidview.dr.focus() });
/** * Check token validity. Token validity window is set to 240 seconds * @param service tokenObject */ let isTokenValid = function (service) { let tokenAge = moment.duration(moment(new Date()).diff(service.lastUpdated)).asSeconds() + TOKEN_INVALIDITY_WINDOW return (tokenAge < service.timeout) }
const expiresIn = expiresAt => Math.round(moment.duration( moment(expiresAt).diff(moment()) ).asSeconds())
function setPosition(newPosition){ var durationTemplate = '00:00:00'.split(''); // replace template characters starting from the last position // with the user given duration in reverse order newPosition.toString().split('').reverse().forEach((character, index) => { durationTemplate[durationTemplate.length - (index + 1)] = character; }); var newPositionDuration = moment.duration(durationTemplate.join('')).asSeconds(); return execute('tell application "Spotify" to set player position to newPositionDuration', {newPositionDuration}); }
function getPosition(){ return execute('tell application "Spotify" to player position').then((positionSecs) => { var position = moment.duration(positionSecs, 'seconds').format('h:mm:ss', { forceLength: true }); if(position.length < 3){ position = `00:${position}`; } return position; }); }
Object.values(serverDocument.members) .filter(a => msg.guild.members.has(a._id)) .sort((a, b) => computeRankScore(b.messages, b.voice) - computeRankScore(a.messages, a.voice)) .slice(0, 5) .map(a => { const score = computeRankScore(a.messages, a.voice); return `**@${client.getName(serverDocument, msg.guild.members.get(a._id))}**: ${score} activity point${score === 1 ? "" : "s"} (${a.messages} message${a.messages === 1 ? "" : "s"}${a.voice > 0 ? `, ${moment.duration(a.voice, "minutes").humanize()} active on voice chat` : ""})`; })
async run(message, args, level, settings) { // eslint-disable-line no-unused-vars const uptime = moment.duration(this.client.uptime).format("D [days], H [hrs], m [mins], s [secs]"); message.channel.send(stripIndents` \`\`\`asciidoc • Uptime :: ${uptime} \`\`\` For a full list of bot stats, use the \`${settings.prefix}stats\` command. `); }
sortedGames .slice(0, 8) .map(game => { const timePlayed = game.time_played * 5; const timeStringSplit = moment.duration(timePlayed, "minutes").humanize().split(" "); return [ `» **${game._id}** «`, `\t**${timeStringSplit[0]}** ${timeStringSplit[1]}`, ].join("\n"); })
/** * Convert seconds into timecode format * @param {Number} seconds - Duration in seconds * @returns {String} - Timecode / HH:mm:ss */ let convertSecondsToTimecode = (seconds) => { // console.debug('convertSecondsToTimecode') return moment.duration(seconds, 'seconds').format(etaFormat, { trim: false }) }
$.timelapse.dr.daterangepicker({ startDate:$.ccio.timeObject().subtract(moment.duration("24:00:00")), endDate:$.ccio.timeObject().add(moment.duration("24:00:00")), timePicker: true, timePickerIncrement: 30, locale: { format: 'MM/DD/YYYY h:mm A' } },function(start, end, label){ $.timelapse.drawTimeline() $.timelapse.dr.focus() });
$.pwrvid.dr.daterangepicker({ startDate:$.ccio.timeObject().subtract(moment.duration("24:00:00")), endDate:$.ccio.timeObject().add(moment.duration("24:00:00")), timePicker: true, timePickerIncrement: 30, locale: { format: 'MM/DD/YYYY h:mm A' } },function(start, end, label){ $.pwrvid.drawTimeline() $.pwrvid.dr.focus() });