GithubHelp home page GithubHelp logo

doublep / datetime Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 3.0 2.38 MB

Library for parsing, formatting, matching and recoding timestamps and date-time format strings.

License: GNU General Public License v3.0

Emacs Lisp 76.38% Java 23.39% Shell 0.23%

datetime's People

Contributors

dependabot[bot] avatar doublep avatar mineo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

datetime's Issues

Parsing fails with 'month out of range'

I am trying to parse a date string which just contains year, month, day immediately concatenated, so 2022-05-06 would be written as 20220506. This is what I try:

(let* ((parser (datetime-parser-to-float 'java "yyyyMMdd" :timezone 'system))
	(parsed (funcall parser "20220506"))))

However, when I execute this, I get

Debugger entered--Lisp error: (datetime-invalid-string "20220506" "yyyyMMdd" "month is out of range")

I get that error even if I add a :non-validating to the parser's options. I think I got the date format string right. Is this a bug?

How to parse and format ISO-8601

I'm excited to use this library, as I suspect it may help with many of my Emacs datetime issues. I had a couple questions about how to make some transformations, and I'm hoping you might be willing to help.

  1. One common scenario is I have a timestamp like this and I want to get the UTC version:
>>> ts = "2018-06-12T22:10:00+03:00"
>>> pendulum.parse(ts).in_tz('UTC').to_iso8601_string()
'2018-06-12T19:10:00Z'
  1. Or I have an org-mode format string and I want the ISO format.
>>> ts = "[2018-06-12 Tue 22:10]"
>>> pendulum.from_format(ts, "[YYYY-MM-DD ddd HH:mm]", tz='America/New_York'
    ).to_iso8601_string()
'2018-06-12T22:10:00-04:00'

I couldn't figure out how to do these in datetime.el. Would you be willing to show how to do this, if that functionality is available? Thanks very much!

the function `define-error' is not known to be defined

Leaving directory `/root/.emacs.d/elpa/datetime-20161007.1137'
^L
Compiling file /root/.emacs.d/elpa/datetime-20161007.1137/datetime-pkg.el at Sat Mar 18 0\
8:03:09 2017
Entering directory `/root/.emacs.d/elpa/datetime-20161007.1137/'
^L
Compiling file /root/.emacs.d/elpa/datetime-20161007.1137/datetime.el at Sat Mar 18 08:03\
:09 2017

In end of data:
datetime.el:1235:1:Warning: the function `define-error' is not known to be
    defined.

What's this problem?

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-08 on lamiak, modi
fied by Debian

Wrong number of arguments define-obsolete-function-alias

I'm playing around with the nativecomp branch of emacs, and I received a (wrong-number-of-arguments (3 . 4) 2) error on line 1524:

(define-obsolete-function-alias 'datetime-pattern-includes-millisecond-p 'datetime-pattern-includes-second-fractionals-p)

I reviewed the git commit log, and I believe this should be replaced by the following line:

(define-obsolete-function-alias 'datetime-pattern-includes-millisecond-p 'datetime-pattern-includes-second-fractionals-p "0.6.1")

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.