summaryrefslogtreecommitdiffstats
path: root/src/components/Properties
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-01 08:45:24 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-01 08:45:24 +0200
commit32483d180bbcf61b068f5534be3aef9d11ee1fdc (patch)
tree21fec642b0ef3be3099ca79ee7fa06e2a1744d79 /src/components/Properties
parentd520d96fee5e791cf7cea9cd5ffcbbbe4ce8d2ea (diff)
Fix date formating and default date value + deps
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/components/Properties')
-rw-r--r--src/components/Properties/PropertyDateTime.vue10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/components/Properties/PropertyDateTime.vue b/src/components/Properties/PropertyDateTime.vue
index 79064bf4..72b101ee 100644
--- a/src/components/Properties/PropertyDateTime.vue
+++ b/src/components/Properties/PropertyDateTime.vue
@@ -76,11 +76,16 @@ let formatDateTime = function(vcardTime, type, locale) {
// the second will be null and not 0
let datetimeData = vcardTime.toJSON()
let datetime = ''
+
+ // FUN FACT: JS date starts month at zero!
+ datetimeData.month--
+
/**
* Make sure to display the most interesting data.
* If the Object does not have any time, do not display
* the time and vice-versa.
*/
+
// No hour, no minute and no second = date only
if (datetimeData.hour === null && datetimeData.minute === null && datetimeData.second === null) {
datetime = moment(datetimeData)
@@ -100,12 +105,13 @@ let formatDateTime = function(vcardTime, type, locale) {
.locale(locale)
.format(
type === 'datetime'
- ? 'LLLL' // date & time display
+ ? 'llll' // date & time display
: type === 'date'
- ? 'LL' // only date
+ ? 'll' // only date
: 'LTS' // only time
)
}
+
return datetimeData.year === null
// replace year and remove double spaces
? datetime.replace(moment(vcardTime).year(), '').replace(/\s\s+/g, ' ')