c-hive / dotdev

Next.js SPA professional website template for teams and individuals: https://c-hive.github.io/dotdev/
MIT License
0 stars 1 forks source link

Basic/empty calendar - [merged] #42

Closed thisismydesign closed 4 years ago

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 09:09

_Merges issue-7basic-calendar -> master

Issue #9.

Created a static JSON calendar to prepare for the SVG displaying.

Questions:

Any ideas about the appearance of the SVG are welcome. Attached a screenshot below.

Képernyőfotó_2019-03-20_-_9.00.32

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 09:12

changed the description

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 20, 2019, 11:01

Responsiveness

Let's not worry about it for now.

dates

Is this necessary for the merge function? The month values should be correct so I guess it is? In that case, there should be a function which can take this and make it into an "up-to-date" empty calendar.

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 20, 2019, 11:04

Size / visibility.

Necessary requirements:

Nice to have requirements:

Feel free to extract this into an issue if needed, sicne they're not all that related to this PR.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 11:12

Yes, the month values should be correct in any case. I'll try to accomplish a function that handles the "up-to-date" functionality.

Regarding the appearance, as you proposed, I'll create a separated issue to make it clear.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 11:18

changed title from Basic{- calendar - JSON-} to Basic{+/empty calendar+}

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 11:29

changed the description

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 12:55

marked as a Work In Progress

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 14:05

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 20, 2019, 14:05

Implemented the feature of updating the contribution dates to the corresponding ones. I'd appreciate if you also tried the functionality out locally.

I'll create the missing tests later.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 08:49

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 09:09

added 2 commits

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 09:15

Missing tests have been completed and I also refined the function to update the basic calendar object properly. Otherwise, here are some questions:

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 09:19

unmarked as a Work In Progress

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 09:21

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 09:51

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:13

Why is string formatting needed there?

new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toLocaleDateString() == new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toLocaleDateString().replace(/. /g, '-').slice(0, 10);
> true

In any case, date formatting should not be done with string formatting. I'm sure there are libraries for that and toLocaleDateString also takes format params: https://stackoverflow.com/a/34015511/2771889

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:13

Same date formatting issue here

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:14

Same date formatting issue here

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:16

I'd also make sure that the last date is correct. Those two should make us fairly certain that it works.

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:17

GetTodaysCalendar maybe?

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:18

Left a few comments, also agree with CalendarUtils, you can just call the file that too.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 10:18

Sounds much better, thanks.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 10:26

That's a good idea, thanks.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 10:27

Does it mean that it's not a good practice to rely on string transformer functions in the case of dates? For example replace, slice and so forth.

Btw you're absolutely right, this should be handled somehow in JS.

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:31

Yep. There're usually very extensive libraries to do this for you. I can show an example from ruby: https://apidock.com/ruby/DateTime/strftime

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:32

But here it also seems to me that no formatting is required, hence the code example.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 21, 2019, 10:41

I don't really get it. Why don't we need to format the date?

thisismydesign commented 4 years ago

In GitLab by @thisismydesign on Mar 21, 2019, 10:42

Because

new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toLocaleDateString() == new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toLocaleDateString().replace(/. /g, '-').slice(0, 10);
> true
thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:33

changed this line in version 7 of the diff

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:33

changed this line in version 7 of the diff

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:33

changed this line in version 7 of the diff

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:33

changed this line in version 7 of the diff

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:33

changed this line in version 7 of the diff

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:33

added 2 commits

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:55

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 00:59

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @bencefrelli on Mar 22, 2019, 09:19

The code looks good to me, just one remark. Are you know the moment.js library? This is a lot of easier date handler. You can format dates and subtract, add days, years etc. Eg: moment().subtract(1, 'years').format(YYYY-MM-DD)

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 09:32

Yes, I have already heard of that library, but didn't know that it can even handle basic operations on dates. The example you mentioned above is much more readable.

I'll take a look at this later.

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 13:53

added 1 commit

Compare with previous version

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 13:53

Cool, it works as expected. Thanks for the proposal @bencefrelli.

thisismydesign commented 4 years ago

In GitLab by @bencefrelli on Mar 22, 2019, 19:10

approved this merge request

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 19:28

merged

thisismydesign commented 4 years ago

In GitLab by @gomorizsolt on Mar 22, 2019, 19:28

mentioned in commit a18dc64f472151f441b70bb59b021ca2d38d1f82