lesli_date 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1e0499e0bb9275a836a6fa624c331be45a49a1b9d8c767e949ddaadd31570ec
4
- data.tar.gz: d0ac965ee5b9b0e414679a4c5086415ea8ca2a29a70b1df5fb93066ed7908e9a
3
+ metadata.gz: 3d046a707bc5a73febdde178a54e4e1442d5c23363d841a4fa84b303596cfe27
4
+ data.tar.gz: 6892b79caea542404efd47199021715018dc7a954bd2ed189beab24193cda3a0
5
5
  SHA512:
6
- metadata.gz: 358df9d6cf226d3b27ab807d1d1c1ca1c071cfbf1ffc5930d3992226d1070de426ee35aab054bc7729366b6f9784ca496612a2230cff984625508061444fba1f
7
- data.tar.gz: 549cf9f2966147f9cf842e0c659532dc706c06e8402f9fff15af99b2b1159372ad67de19518ea3dd6307054b4b4195078d41c7e4c1c45e8de34ddafc19f35c0b
6
+ metadata.gz: d1265c6d43a4e98c892485cc529c471c267deea07282764f834fe1d545245b49c74848026fb4ce6e1a7b7bc9c0e94e816d805d0f02a8e7f98aab5e877ffe50d1
7
+ data.tar.gz: a40d0aa2c27131dab48338bdae7fdddedde4b02983f1440014f8bea3978fc7c8e02334173915dd2ccaa0817bae7f5848afee18bc63e2b86bdabe773d3fb87bef
@@ -117,12 +117,20 @@ module LesliDate
117
117
  # get right format for dates
118
118
  format = self.db_format
119
119
 
120
+ # compatibility for SQLite
121
+ if ActiveRecord::Base.connection.adapter_name == "SQLite"
122
+ offset = ActiveSupport::TimeZone[@settings[:time_zone]].utc_offset / 3600
123
+ return "strftime('#{format}', #{table}created_at, '#{offset} hours') as created_at_string"
124
+ end
125
+
120
126
  "TO_CHAR(#{table}created_at at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as created_at_date, TO_CHAR(#{table}updated_at at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as updated_at_date"
121
127
 
122
128
  end
123
129
 
124
130
  # return query string to get a datetime column from database
125
- def db_column column, table=""
131
+ def db_column column, table="", as:nil
132
+
133
+ as = "#{column}_string" unless as
126
134
 
127
135
  # avoid ambiguous columns
128
136
  table = table.concat(".") if table != ""
@@ -132,10 +140,11 @@ module LesliDate
132
140
 
133
141
  # compatibility for SQLite
134
142
  if ActiveRecord::Base.connection.adapter_name == "SQLite"
135
- return "strftime('#{format}', #{table}#{column}) as #{column}_string"
143
+ offset = ActiveSupport::TimeZone[@settings[:time_zone]].utc_offset / 3600
144
+ return "strftime('#{format}', #{table}#{column}, '#{offset} hours') as #{as}"
136
145
  end
137
146
 
138
- "TO_CHAR(#{table}#{column} at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as #{column}_string"
147
+ "TO_CHAR(#{table}#{column} at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as #{as}"
139
148
 
140
149
  end
141
150
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LesliDate
4
- VERSION = "0.1.0"
5
- BUILD = "1751158704"
4
+ VERSION = "1.0.0"
5
+ BUILD = "1771715352"
6
6
  end
data/lib/lesli_date.rb CHANGED
@@ -6,4 +6,10 @@ require "lesli_date/version"
6
6
  #require "lesli_date/engine"
7
7
 
8
8
  module LesliDate
9
+ class Compatibility
10
+ def self.db_now
11
+ return 'CURRENT_TIMESTAMP' if ActiveRecord::Base.connection.adapter_name == "SQLite"
12
+ return 'NOW()' #postgresql
13
+ end
14
+ end
9
15
  end
data/readme.md CHANGED
@@ -1,5 +1,4 @@
1
-
2
- <div align="center">
1
+ <div align="center" class="documentation-header">
3
2
  <img width="100" alt="LesliDate logo" src="./docs/images/date-logo.svg" />
4
3
  <h3 align="center">Standard Datetime Formatter for The Lesli Framework.</h3>
5
4
  </div>
@@ -7,21 +6,25 @@
7
6
  <br />
8
7
  <hr/>
9
8
 
10
- <p align="center" class="is-flex is-justify-content-center">
11
- <a target="blank" href="https://rubygems.org/gems/lesli">
12
- <img height="22" alt="Gem Version" src="https://badge.fury.io/rb/lesli.svg"/>
9
+ <div align="center" class="documentation-statics">
10
+ <a target="blank" href="https://github.com/LesliTech/LesliDate/actions">
11
+ <img alt="Tests passing" src="https://img.shields.io/badge/Tests-passing-green?style=for-the-badge&logo=github">
12
+ </a>
13
+ <a target="blank" href="https://rubygems.org/gems/lesli_date">
14
+ <img alt="Gem Version" src="https://img.shields.io/gem/v/lesli_date?style=for-the-badge&logo=ruby">
13
15
  </a>
14
- <a class="mx-2" href="https://codecov.io/github/LesliTech/Lesli">
15
- <img height="22" src="https://codecov.io/github/LesliTech/Lesli/graph/badge.svg?token=2O12NENK5Y"/>
16
+ <a target="blank" href="https://codecov.io/github/LesliTech/LesliDate">
17
+ <img alt="Codecov" src="https://img.shields.io/codecov/c/github/LesliTech/LesliDate?style=for-the-badge&logo=codecov">
16
18
  </a>
17
- <a href="https://codecov.io/github/LesliTech/LesliBabel">
18
- <img height="22" src="https://sonarcloud.io/api/project_badges/measure?project=LesliTech_LesliBabel&metric=sqale_rating"/>
19
+ <a target="blank" href="https://sonarcloud.io/project/overview?id=LesliTech_LesliView">
20
+ <img alt="Sonar Quality Gate" src="https://img.shields.io/sonar/quality_gate/LesliTech_LesliView?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud&label=Quality">
19
21
  </a>
20
- </p>
22
+ </div>
21
23
 
22
24
  <hr/>
23
25
  <br />
24
26
 
27
+
25
28
  ### Quick start
26
29
 
27
30
  ```shell
@@ -29,22 +32,32 @@
29
32
  bundle add lesli_date
30
33
  ```
31
34
 
35
+
36
+ <br />
37
+ <hr/>
38
+ <br />
39
+
40
+ ### Demo
41
+
42
+ * [online demo](https://demo.lesli.dev/)
43
+ * [docker demo](https://github.com/LesliTech/lesli-docker-demo)
44
+
45
+
32
46
  ### Documentation
33
47
  * [website](https://www.lesli.dev/)
34
- * [database](./docs/database.md)
35
- * [documentation](https://www.lesli.dev/gems/gems/)
48
+ * [documentation](https://www.lesli.dev/gems/date/)
36
49
 
37
50
 
38
- ### Get in touch with Lesli
51
+ ### Connect with Lesli
39
52
 
53
+ * [X: @LesliTech](https://x.com/LesliTech)
40
54
  * [Email: hello@lesli.tech](hello@lesli.tech)
41
55
  * [Website: https://www.lesli.tech](https://www.lesli.tech)
42
- * [Twitter: @LesliTech](https://twitter.com/LesliTech)
43
56
 
44
57
 
45
58
  ### License
46
59
  -------
47
- Copyright (c) 2025, Lesli Technologies, S. A.
60
+ Copyright (c) 2026, Lesli Technologies, S. A.
48
61
 
49
62
  This program is free software: you can redistribute it and/or modify
50
63
  it under the terms of the GNU General Public License as published by
@@ -59,11 +72,17 @@ GNU General Public License for more details.
59
72
  You should have received a copy of the GNU General Public License
60
73
  along with this program. If not, see http://www.gnu.org/licenses/.
61
74
 
75
+ <br />
62
76
  <hr />
63
77
  <br />
78
+ <br />
64
79
 
65
- <p align="center">
80
+ <div align="center" class="has-text-centered">
66
81
  <img width="200" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-logo.svg" />
67
- <h4 align="center">Ruby on Rails SaaS Development Framework.</h4>
68
- </p>
82
+ <h3 align="center" class="mt-0">
83
+ The Open-Source SaaS Development Framework for Ruby on Rails.
84
+ </h3>
85
+ </div>
69
86
 
87
+ <br />
88
+ <br />
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-06-29 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Datetime formatter and SQL-safe utilities for Rails, part of the LesliSystem
14
13
  email:
@@ -31,7 +30,6 @@ metadata:
31
30
  homepage_uri: https://www.lesli.dev/
32
31
  changelog_uri: https://github.com/LesliTech/LesliDate
33
32
  source_code_uri: https://github.com/LesliTech/LesliDate
34
- post_install_message:
35
33
  rdoc_options: []
36
34
  require_paths:
37
35
  - lib
@@ -46,8 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
44
  - !ruby/object:Gem::Version
47
45
  version: '0'
48
46
  requirements: []
49
- rubygems_version: 3.4.19
50
- signing_key:
47
+ rubygems_version: 3.7.1
51
48
  specification_version: 4
52
49
  summary: Standard Datetime Formatter for The Lesli Framework.
53
50
  test_files: []