Files
mixtape/zero.Web.UI/App/directives/date.js
T

19 lines
348 B
JavaScript
Raw Normal View History

2020-10-15 14:10:38 +02:00
import Vue from 'vue';
import Strings from 'zero/helpers/strings.js';
2020-04-21 16:23:43 +02:00
/// <summary>
/// Outputs a formatted date
/// </summary>
2020-10-15 14:10:38 +02:00
Vue.directive('date', (el, binding) =>
{
if (binding.value !== binding.oldValue)
2020-04-21 16:23:43 +02:00
{
2020-10-15 14:10:38 +02:00
if (!binding.value)
2020-04-21 16:23:43 +02:00
{
2020-10-15 14:10:38 +02:00
el.innerHTML = '-';
return;
2020-10-14 01:55:51 +02:00
}
2020-10-15 14:10:38 +02:00
el.innerHTML = Strings.date(binding.value);
2020-04-21 16:23:43 +02:00
}
2020-10-15 14:10:38 +02:00
});