Absolute date



  • I am trying to get the calendar module display my calendar in absolute date. I want appointments to read the actual time of the appointment, e.g. “3PM”

    This is what my MM is doing:

    Appointment today: in an hour
    Appointment tomorrow: Tomorrow at 11 AM
    Appointment 2 days from now: Tuesday at 12PM
    Appointment 4 days from now: In 4 days

    Here’s the calendar part of my config.js: (apologies, I know I’m supposed to post this in markdown but am not sure how)

    {
    module: ‘calendar’,
    header: ‘Calendar’,
    position: ‘top_left’,
    config: {
    calendars: [
    {
    symbol: 'calendar-check-o ',
    url: ‘redacted’,

    				},
    

    {
    symbol: ‘rocket’,
    url: ‘redacted’
    }

    			]
    

    Here’s what the top part of my calendar.js file looks like:

    Module.register(“calendar”,{

    // Define module defaults
    defaults: {
    	maximumEntries: 10, // Total Maximum Entries
    	maximumNumberOfDays: 365,
    	displaySymbol: true,
    	defaultSymbol: "calendar", // Fontawesome Symbol see http://fontawesome.io/cheatsheet/
    	displayRepeatingCountTitle: false,
    	defaultRepeatingCountTitle: '',
    	maxTitleLength: 15,
    	fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
    	animationSpeed: 2000,
    	fade: false,
    	urgency: 7,
    	timeFormat: "absolute",
    	fadePoint: 0.25, // Start on 1/4th of the list.
    	calendars: [
    		{
    			symbol: "calendar",
    			url: "http://www.calendarlabs.com/templates/ical/US-Holidays.ics",
    		},
    	],
    	titleReplace: {
    		"De verjaardag van ": "",
    		"'s birthday": ""
    	},
    },
    

    Any help is appreciated.

    Nathan



  • Anyone? Does anyone have absolute date working as I describe? Can someone post the relevant portion of their config file so I can see what you’ve done?

    Thanks.



  • Any word on this? I’m using a 7" raspberry pi display and that ‘Tomorrow at 10:00 AM’ eats up a lot of real estate.

    Here’s my config:

                {
                        module: 'calendar',
                        header: 'My Calendar',
                        position: 'top_right',
                        config: {
                          calendars: [
                            {
                              symbol: 'calendar-check-o ',
                              url: '[redacted]'
                            }
                          ],
                          maximumEntries: 10,
                          maxTitleLength: 12,
                          titleReplace: {'Appointment':'Appt'},
                          displaySymbol: false,
                          timeFormat: 'relative'
                        }
                },


  • … and by
    {
    timeFormat: ‘relative’
    }

    I mean
    {
    timeFormat: ‘absolute’
    }
    ugh.



  • This post is deleted!


  • Turns out my problem came down mostly to not really understanding the difference between ‘absolute’ and ‘relative’… I fixed my problem by modifying the code in calendar.js slightly.

     // Otherwise just say 'Today/Tomorrow at such-n-such time'
     timeWrapper.innerHTML = moment(event.startDate, "x").calendar(null, {
                                                            sameDay: 'H:mm',
                                                            nextDay: '[Tomorrow] H:mm',
                                                            nextWeek: 'dddd',
                                                            lastDay: '[Yesterday]',
                                                            lastWeek: '[Last] dddd',
                                                            sameElse: 'DD/MM/YYYY'
                                                        });
    

    I sort of hijacked this thread. Sorry (but I think my solution might help out the OP ).



  • @mjtice What lines did you implement that code on?



  • @mjtice Thanks man, that solved my problem too. Except I added NextWeek: ‘dddd DD/MM/YYYY’

    Cheers!



  • @daikaiju it’s on line 245 in the current release. Keep in mind that if you upgrade you’ll lose those changes (as I did exactly 2 days after I made that post…).


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.