summaryrefslogtreecommitdiffstats
path: root/src
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
parentd520d96fee5e791cf7cea9cd5ffcbbbe4ce8d2ea (diff)
Fix date formating and default date value + deps
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/Properties/PropertyDateTime.vue10
-rw-r--r--src/main.js4
-rw-r--r--src/models/rfcProps.js16
3 files changed, 24 insertions, 6 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, ' ')
diff --git a/src/main.js b/src/main.js
index 628772b0..aea10604 100644
--- a/src/main.js
+++ b/src/main.js
@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+import '@babel/polyfill'
import Vue from 'vue'
import App from './App'
@@ -33,8 +34,9 @@ __webpack_nonce__ = btoa(OC.requestToken)
// Correct the root of the app for chunk loading
// OC.linkTo matches the apps folders
// OC.generateUrl ensure the index.php (or not)
+// We do not want the index.php since we're loading files
// eslint-disable-next-line
-__webpack_public_path__ = OC.generateUrl(OC.linkTo('contacts', 'js/'))
+__webpack_public_path__ = OC.linkTo('contacts', 'js/')
sync(store, router)
diff --git a/src/models/rfcProps.js b/src/models/rfcProps.js
index 8b4a6731..30745eeb 100644
--- a/src/models/rfcProps.js
+++ b/src/models/rfcProps.js
@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+import { VCardTime } from 'ical.js'
const properties = {
nickname: {
@@ -92,15 +93,24 @@ const properties = {
},
bday: {
readableName: t('contacts', 'Birthday'),
- icon: 'icon-calendar-dark'
+ icon: 'icon-calendar-dark',
+ defaultValue: {
+ value: new VCardTime().fromJSDate(new Date())
+ },
},
anniversary: {
readableName: t('contacts', 'Anniversary'),
- icon: 'icon-calendar-dark'
+ icon: 'icon-calendar-dark',
+ defaultValue: {
+ value: new VCardTime().fromJSDate(new Date())
+ },
},
deathdate: {
readableName: t('contacts', 'Date of death'),
- icon: 'icon-calendar-dark'
+ icon: 'icon-calendar-dark',
+ defaultValue: {
+ value: new VCardTime().fromJSDate(new Date())
+ },
},
email: {
multiple: true,