Giter Club home page Giter Club logo

klog-js's Introduction

Klog.js

A JavaScript implementation of the Klog file format, a simple plain-text format for time tracking. This library allows you to parse and manipulate Klog files with ease.

Features

  • Parse Klog files into JavaScript classes
  • Create and manipulate Klog entries programmatically
  • Serialize classes back into the Klog format

Installation

Install the package using whichever package manager you desire:

npm install klog.js
pnpm add klog.js
yarn add klog.js

Usage

Parsing a Klog file

import { parse } from "klog.js";

const klogContent = `
2024-06-01
    2h Working on project A
    1h Meeting with client

2024-06-02
    3h Development work
`;

const records = parse(klogContent);
console.log(records);

Creating records manually

import { Record, Entry } from "klog.js";

const record = new Record(new Date(2024, 1, 24), [
  new Entry(new Range(new Time(9, 30), new Time(15, 45))),
  new Entry(new Duration(-1, 0), new Summary("Lunch break & shopping")),
]);
/* `record.toString()` =>
2024-02-24
    9:30 - 15:45
    -1h Lunch break & shopping
*/

Klog Format

The Klog file format is a plain-text format for time tracking. For detailed information on the Klog format, visit the Klog documentation.

TODO

  • Automatic wrapping of summary lines?
  • Applying the same formatting options across all entries in a record.
  • Get warnings for a record (similar to how Klog does).
  • toKlogJSON for classes that returns an object compatible with klog json.
  • Other miniscule fixes around formatting, especially with summaries.

Reporting Bugs

If you find a Klog file that works fine with the original Klog tool by @jotaen but does not also work with this library, please open an issue with the problem file and what's wrong and we will do our best to fix it.

License

This project is licensed under the MIT License. See the LICENSE file for details.

klog-js's People

Contributors

ovyerus avatar

Stargazers

 avatar

Watchers

 avatar

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.