Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Calendar QR Code #202

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

muarachmann
Copy link

@muarachmann muarachmann commented Oct 7, 2020

This adds the Calendar Datatype interface to the QR code and will solve #116
Usage

QrCode::Calendar([
'summary' => 'Summary of the Event', // Mandatory
'location' => 'Event's location', 
'url' => 'Event Url',
'startDateTime' => 'Event start data and time', // DateTime format "Y-m-d H:i"  Mandatory
'endDateTime' => 'Event end date and time' // DateTime format "Y-m-d H:i" Optional
]);

@SimplyCorey I think the summary, start_date_time and end_date_time should be mandatory or at least the summary and start date,. My thoughts, if end date is not provided it takes into consideration the event is a one day event and ends at the same time the following day. Also I choose the Y-m-d H:i since event times usually take those format. Let me know your thoughts or any corrections. So I can complete the tests

@SimplyCorey
Copy link
Member

@muarachmann Thanks for knocking this out.

I agree that summary and start_date_time should be mandatory. I think end_date_time should be optional. Let's use camelCase for these arguments, startDateTime and endDateTime.

Date time formats get really strange across languages and countries. What do you of having Y-m-d H:i as the default, but adding one more argument dateTimeFormat so they can provide any format they want to use as long as DateTime can understand it.

@SimplyCorey SimplyCorey linked an issue Oct 7, 2020 that may be closed by this pull request
@muarachmann
Copy link
Author

@SimplyCorey I see I did not cover extra parameters like categories, alarms, reminders, etc. To this effect, I think the structure should be slightly modified to something like this ...

QrCode::Calendar([
  'summary' => 'Summary of the Event', // Mandatory
  'location' => 'Event's location', 
  'url' => 'Event Url',
  'description' => 'event's full description',
  'categories' => ['Business', 'Anniversary'],
  'timezone' => 'Africa/Douala',
  'startDateTime' => 'Event start data and time', // DateTime format "Y-m-d H:i"  Mandatory
  'endDateTime' => 'Event end date and time', // DateTime format "Y-m-d H:i" Optional
  'alarm' => [
      'trigger' => [
              'weeks' => 1,
              'days' => 5,
              'hours' => 4,
              'mins' => 2,
              'seconds' => 0,
              'before' => true,  // by default
       ],
      'repeat' => 2,
      'description' => 'Foo's event will be made up of excellent gorceries',
      'summary' => 'You need to attend event Foo',
      ],
]);

@SimplyCorey Let me know your thought. Also I don't know why the CI keeps failing? it leads to an unauthorized link

@SimplyCorey
Copy link
Member

I like that proposed method call.

The CI is failing because of a few issues with the code formatting. You should be able to use styleci.org and open a PR request to fix the styling issues using the laravel preset.

Worse case I can run the fixer after the PR is wrapped up to get the styling issues fixed.

Added QR Code Calendar Datatype and wrote some unit tests.

Signed-off-by: Mua N. Laurent <muarachmann@gmail.com>
@muarachmann
Copy link
Author

@SimplyCorey Fixed the issues and added some more test. The Repeat Rule is so cumbersome and lots of parameters which I wont have time for now maybe later. Having to validate each stuff. How about letting this be a string for now and can point them to a global generator maybe in the docs. I found this tool quite handy for this https://www.textmagic.com/free-tools/rrule-generator

Aside that, everything else works from summary to alarm. Let me know your thoughts on this.

@SimplyCorey
Copy link
Member

I'm okay with that. Thanks for working on this. Someone else can carry the torch in the future if that feature is wanted at a later time 👍

@mzeeshan455 mzeeshan455 mentioned this pull request May 18, 2021
@mzeeshan455
Copy link

Year is not work correctly it repeat last two digit i.e 2021,1993 select this and output is 2121,9393 ...

My code is here below

QrCode::style('round')->size(300)->Calendar([
'summary' => 'Summary of the Event', // Mandatory
'location' => 'https://github.com//pull/202',
'url' => 'https://github.com//pull/202',
'startDateTime' => '2021-02-03 12:12', // DateTime format "Y-m-d H:i" Mandatory
'endDateTime' => '2021-02-03 12:12' // DateTime format "Y-m-d H:i" Optional
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Qrcode calendar
3 participants