Skip to content

Commit

Permalink
Improved date formatting for extendedUpdates adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindavid committed Jan 16, 2019
1 parent a92e63d commit 0561661
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/js/app.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
<td class="blank-cell"></td>
<td class="blank-cell"></td>
<td>
{{adjustment.name}}
<template v-if="adjustment.sourceSnapshot.type === 'extendedUpdates'">
{{"Updates until {date}"|t('app', {date: $options.filters.formatDate(adjustment.sourceSnapshot.expiryDate)})}}
</template>
<template v-else>
{{adjustment.name}}
</template>
</td>
<td class="price">
{{adjustment.amount|currency}}
Expand Down Expand Up @@ -313,6 +318,9 @@
return true
},
updatesUntil(date) {
return this.$options.filters.t("Updates until {date}", 'app', {date})
}
},
}
Expand Down
7 changes: 6 additions & 1 deletion src/web/assets/pluginstore/src/js/filters/craft.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export function t(message, category, params) {
return Craft.t(category, message, params)
}


export function formatDate(date) {
return Craft.formatDate(date)
}

export function formatNumber(number, format = ',.0f') {
return Craft.formatNumber(number, format)
}
}
3 changes: 2 additions & 1 deletion src/web/assets/pluginstore/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import Vue from 'vue'
import {currency} from './js/filters/currency'
import {escapeHtml, formatNumber, t} from './js/filters/craft'
import {escapeHtml, formatDate, formatNumber, t} from './js/filters/craft'
import router from './js/router'
import store from './js/store'
import {mapState} from 'vuex'
Expand All @@ -18,6 +18,7 @@ import './js/plugins/font-awesome'

Vue.filter('currency', currency)
Vue.filter('escapeHtml', escapeHtml)
Vue.filter('formatDate', formatDate)
Vue.filter('formatNumber', formatNumber)
Vue.filter('t', t)

Expand Down

0 comments on commit 0561661

Please sign in to comment.