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

using "date-basic" with no end date #22

Open
mrjonnywood opened this issue Aug 22, 2017 · 2 comments
Open

using "date-basic" with no end date #22

mrjonnywood opened this issue Aug 22, 2017 · 2 comments
Assignees
Labels

Comments

@mrjonnywood
Copy link

I've just started using your plugin and it's great! However, I'm having a slight issue in getting dates to show up when only a start date (day, month, year) has been defined and no end date. This is what I have:

$mem_date = mem_date_processing( 
    get_post_meta($post->ID, '_mem_start_date', true) , 
    get_post_meta($post->ID, '_mem_end_date', true)
);

if ($mem_date["start-iso"] !=="") {
    echo '<h5 class="small-title">' . $mem_date["date-basic"] . '</h5>';
}

Dates with both start and end show up but the ones with only a start date output the h5 tag but nothing else.

@ms-studio
Copy link
Owner

ms-studio commented Aug 22, 2017

Thanks for reporting! Indeed, I can reproduce the problem.

For a date input such as '2017-09-13', the result of mem_date_processing() is:

'date' => string 'Wednesday, September 13th 2017' (length=30)
'date-short' => string 'September 2017' (length=14)
'date-basic' => string '' (length=0)

I will have a look at what's wrong with 'date-basic'.

@ms-studio ms-studio self-assigned this Aug 22, 2017
@ms-studio ms-studio added the bug label Aug 22, 2017
@ms-studio
Copy link
Owner

Hi @mrjonnywood, I revisited the conditional structure, and made this visual that shows the logic.

Here's the concept of the different date display types:

"date" : Displays the date with all available information, including year, month, day, time. Example: "Tuesday March 15th 2013, 8:30 AM".

"date-short" : Precision level stops at year and month. Doesn't show day or time information. Year is always displayed. Example: "March 2013".

"date-basic" : Doesn't show time. Doesn't show the year. Day numeral is displayed without the "th". Example: "March 15".

Let me know if this "date-basic" variant matches your use-case. As it wasn't complete, this variant hasn't ever been used – so we may modify the formatting according to what you need.

Another interesting feature could be to display the year, but only if it differs from the current year.

ms-studio added a commit that referenced this issue Jan 9, 2019
This should fix issue #22 (using "date-basic" with no end date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants