export default {
    methods: {
        treatAsUTC: function (date) {
            var result = new Date(date);
            result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
            return result;
        },
        daysSinceToday: function (date) {
            var currentDate = new Date();
            var millisecondsPerDay = 24*60*60*1000;
            return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
        },
        getHRDate: function (dateString) {
            var date = new Date(dateString);
            return date.toLocaleString('default', {month:'short', day:'numeric', year: 'numeric', hour:'numeric', minute:'numeric'})
        },
        isZero: function(dateString) {
            return dateString === '0000-00-00 00:00:00'
        }
    }
}