Coder Social home page Coder Social logo

Comments (9)

lervag avatar lervag commented on July 29, 2024

Oh, sorry about that. The lack of complaints have made me forget about fixing this. I'll make it a priority to update this now!

from wiki.vim.

jounathaen avatar jounathaen commented on July 29, 2024

I created a pull-request #22

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Ok, I've pushed a first version. I think the updated docs should be easily understandable. Let me know what you think.

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

I'll look at the issue with the bad buffer filename. Could you give me the output when you do e.g. echo wiki#date#get_week('2019-03-13')? I suspect there might be something wrong here. If the output is strange, please next try date +%V -d 2019-03-13 in a terminal. Also, it would be interesting to see the output of date --version.

from wiki.vim.

jounathaen avatar jounathaen commented on July 29, 2024
echo wiki#date#get_week('2019-03-13')
date: illegal time format
> date +%V -d 2019-03-13
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

date --version does not work, but in the manpage I see, that it is the BSD implementation (Macbook). On a Linux machine it works.

To get the weeknumber from a given date in BSD, apparently you have to use:

$ date -j -f '%Y-%m-%d' '2019-03-13' +%V
11

Which does not work on my Linux machine anymore...
(apparently others already had simmilar problems https://stackoverflow.com/questions/8747845/how-can-i-detect-bsd-vs-gnu-version-of-date-in-shell-script)

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Sorry about the delay. I've tried to add the BSD syntax as a fallback. Let me know if it works.

from wiki.vim.

jounathaen avatar jounathaen commented on July 29, 2024

Seems to work 👍

from wiki.vim.

jounathaen avatar jounathaen commented on July 29, 2024

Hmm, unfortunately not.
Now wiki#date#get_week('2019-03-13') works, but when I open a journal entry outside of the current directory and call WikiJournalToWeek, it creates a file with the name journal/Use_wFailed conversion of "journal/2019-03-08'' using format "%Y-%m-%d''.wiki. It looks a bit as if the get_week() function is called with the filepath as argument.

When cd into the journal directory, open the journal in that directory and call WikiJournalToWeek, I get the following Error:

Error detected while processing function wiki#buffer#init[22]..<SNR>136_apply_template[8]..wiki#template#weekly_summary[7]..wiki#date#get_week_dates:
line   15:
E687: Less targets than List items

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Ah, I assume it is because there are more calls to date. If you look in the function ...#get_week_dates you see it has 4 calls (two in each conditional block).

In general, the entire date.vim module has a strict dependency on the date util.

The following calls are made and works on Linux:

# In "get_day_of_week"
date +%u -d 2019-03-21

# In get_next_weekday
date +%F -d "2019-03-21 +1 day"

# In get_week_dates
date +%u -d 2019-03-21
date +%F -d "2019-03-21 n days"
date +"%V %u" -d 2019-03-21

Here I've inserted "2019-03-21" for the input date. The +%u should give the day of the week (1 for Monday, 2 for Tuesday, and so on). So, it would help if I could get the corresponding date commands for BSD.

from wiki.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.