Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
// defaults
let width = 750
let height = 110
let legendWidth = 150
let selector = '.vuejs-heatmap'
let SQUARE_LENGTH = 11
let SQUARE_PADDING = 2
let MONTH_LABEL_PADDING = 6
let now = moment().endOf('day').toDate()
let yearAgo = moment().startOf('day').subtract(1, 'year').toDate()
let startDate = null
let data = []
let max = null
let colorRange = ['#D8E6E7', '#218380']
let tooltipEnabled = true
let tooltipUnit = 'Star'
let legendEnabled = true
let onClick = null
let weekStart = 0 //0 for Sunday, 1 for Monday
let locale = {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
days: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
No: 'No',
on: 'on',
Less: 'Less',
value = moment(date, format).format(format);
if (value === 'Invalid date') {
sage.logger.warn(
`Could not decipher value: ${date}, using Date() value ${new Date(
date
)}`
);
value = moment(new Date(date)).format(format);
}
}
break;
case 'timestamp':
var format = this.schema.definition[key].format;
var date = this.get(key);
if (date) {
value = moment(date, format).format(format);
if (value === 'Invalid date') {
sage.logger.warn(
`Could not decipher value: ${date}, using Date() value ${new Date(
date
)}`
);
value = moment(new Date(date)).format(format);
}
}
break;
// Blobs must be converted to a buffer before inserting into Oracle
// this should work even if it's already a buffer so we don't need to check
case 'blob':
if (this.get(key) !== undefined && this.get(key) !== null) {
value = new Buffer(this.get(key));
const unitCount = isNightly
? nightsBetween(bookingStart, bookingEnd)
: isDaily
? daysBetween(bookingStart, bookingEnd)
: quantity;
const totalPrice = estimatedTotalPrice(unitPrice, unitCount);
// bookingStart: "Fri Mar 30 2018 12:00:00 GMT-1100 (SST)" aka "Fri Mar 30 2018 23:00:00 GMT+0000 (UTC)"
// Server normalizes night/day bookings to start from 00:00 UTC aka "Thu Mar 29 2018 13:00:00 GMT-1100 (SST)"
// The result is: local timestamp.subtract(12h).add(timezoneoffset) (in eg. -23 h)
// local noon -> startOf('day') => 00:00 local => remove timezoneoffset => 00:00 API (UTC)
const serverDayStart = dateFromLocalToAPI(
moment(bookingStart)
.startOf('day')
.toDate()
);
const serverDayEnd = dateFromLocalToAPI(
moment(bookingEnd)
.startOf('day')
.toDate()
);
return {
id: new UUID('estimated-transaction'),
type: 'transaction',
attributes: {
createdAt: now,
lastTransitionedAt: now,
lastTransition: TRANSITION_REQUEST_PAYMENT,
getTotal() {
//console.log("this.props.vaccineCountsModel.getTotalDestinationCounts is ",this.props.vaccineCountsModel.getTotalDestinationCounts);
if (!this._total) {
this._total = this.props.vaccineCountsModel.getTotalDestinationCounts('河南', moment().unix()).vaccine_countApplications;
}
console.log("this._total is",this._total);
return this._total;
}
'Yesterday': () => {return [
moment().startOf('day').subtract(1, 'days'),
moment().endOf('day').subtract(1, 'days')
];},
'Day before yesterday':() => {return [
folder && folder.notes && folder.notes.map((note) => {
return this.setNoteModalOpen(note.path)}>
})
}
preview() {
const { articleInfo } = this.props.articleStore;
const previewData: PreviewData = {
title: articleInfo.title || 'Untitled',
pathname: articleInfo.pathname || 'untitled',
markdown_content: articleInfo.markdown_content,
create_time: articleInfo.create_time,
update_time: moment().format('YYYY-MM-DD HH:mm:ss'),
user: this.props.userStore.userList.filter(
user => +user.id === +articleInfo.user_id,
)[0],
comment_num: 0,
allow_comment: 0,
options: JSON.stringify(articleInfo.options),
};
if (this.type === 0) {
previewData.tag = articleInfo.tag.map(tagName => {
return (
this.props.sharedStore.tagList.filter(
tag => tag.name === tagName,
)[0] || { name: tagName }
);
});
render() {
this.renderedTimeAgo = moment(this.model.get('timestamp')).fromNow();
loadTemplate('chat/convoMessage.html', (t) => {
this.$el.html(t({
...this.model.toJSON(),
...this.getState(),
moment,
message: this.model.get('message'),
renderedTimeAgo: this.renderedTimeAgo,
ownGuid: app.profile.id,
}));
});
return this;
}
}
);
};
renderRow(keyLanguage) {
const buttonClass = this.props.isLoading ? 'text-muted' : 'text-primary'
const hasMine = Boolean(keyLanguage.translations.findIndex(({ author }) => author._id === this.props.userId) + 1)
return [
{keyLanguage.key.name}
v{keyLanguage.version}
{moment(keyLanguage.createdAt).fromNow()}
{keyLanguage.note !== undefined && keyLanguage.note.length !== 0
? (
<i>
)
:
}
{keyLanguage.key.url !== undefined && keyLanguage.key.url.length !== 0
? (
</i>